UR::Ob...:Style(3pm)

πŸ“¦
version 0.470 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

✨ NAME ✨

UR::Object::Command::List β€” bestie, this one fetches and lists objects in different styles. That's the whole job. It's giving "I do one thing and I do it fabulously" πŸ’…

(this page itself lives under the manual name UR::Ob...:Style(3pm), iykyk β€” it's the style chapter of the saga πŸŽ€)


🌸 SYNOPSIS 🌸

okay so to actually use this, you subclass it. Periodt:

package MyLister;

use strict;
use warnings;

use above "UR";

class MyLister {
    is => 'UR::Object::Command::List',
    has => [
    # add/modify properties
    ],
};

1;

That's it, that's the starter pack. Now let's talk about what you can customize πŸ’–


🫢 Provided by the Developer 🫢

these are the knobs you, the developer, get to turn so your end users have a good time. no cap.

🌟 subject_class_name (optional)

So subject_class_name is the class whose objects are gonna get fetched. You can lock this in one of two main ways:

by_the_end_user_on_the_command_line

For this one, do literally nothing πŸ™ˆ β€” the end user has to provide it themselves when the command gets run. hands-off queen energy.

by_the_developer_in the_class_declartion

For this one, in the class declaration you add a has key with an arrayref of hashrefs. One of those hashrefs needs to be subject_class_name. Give it this declaration:

 class MyFetchAndDo {
     is => 'UR::Object::Command::FetchAndDo',
     has => [
         subject_class_name => {
             value => <CLASS NAME>,
             is_constant => 1,
         },
     ],
 };
note that <CLASS NAME> is a placeholder, bestie β€” swap in the real class name, don't ship the angle brackets 😭

πŸŽ€ show (optional)

Want to set up defaults for the show property? Easy. Add them like this:

 class MyFetchAndDo {
     is => 'UR::Object::Command::FetchAndDo',
     has => [
         show => {
             default_value => 'name,age',
         },
     ],
 };

so the user just gets name,age out of the box. iconic.

πŸ¦‹ helps (optional)

This one is for when you wanna overwrite the help_brief, help_synopsis and help_detail methods so you can serve up your own specific help. Very main character of you.

And if you're overwriting the help_detail method specifically β€” use _filter_doc to grab the filter documentation and usage, then combine it with your own specific help. Don't reinvent the filter docs, that's not the vibe πŸ’€


🌈 List Styles 🌈

Here's the menu of styles you can list things in:

  • text
  • csv
  • html
  • xml
  • pretty (inprogress)
pretty is marked inprogress in the original, so like… it's on its way, be patient, she's still getting ready 🧚

that's the whole page, bestie! πŸ“ this was UR::Ob...:Style(3pm) from the User Contributed Perl Documentation, running on perl v5.32.1, dated 2022-01-17. go forth and list your objects in style βœ¨πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from