UR::Ob...d::List(3pm)

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

πŸ’– NAME πŸ’–

UR::Object::Command::List β€” bestie, this is the little command class that fetches and lists objects in different styles. ✨ That's it, that's the whole job, and it does it gorgeously.

Also hi, welcome to the manual page UR::Ob...d::List(3pm) β€” yes the name got squished by the terminal, she's still iconic, don't worry about it. 🫢


✨ SYNOPSIS ✨

Subclass it, add or tweak your properties, boom, you have a lister:

package MyLister;

use strict;
use warnings;

use above "UR";

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

1;

Literally that's the whole vibe. 🌸


πŸŽ€ Provided by the Developer πŸŽ€

These are the knobs you, the developer, get to play with. The end user doesn't touch these, they're your little backstage passes. 🎫

subject_class_name (optional)

The subject_class_name is the class for which the objects will be fetched. You can set this up one of two main ways, and yes you have to pick one, no you can't do both and expect a slay.

by_the_end_user_on_the_command_line

For this one you literally do nothing. Do not pass go. The end user will have to provide it when the command is run. That's their problem now, bestie. πŸ’…

by_the_developer_in the_class_declartion

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

class MyFetchAndDo {
    is => 'UR::Object::Command::FetchAndDo',
    has => [
        subject_class_name => {
            value => <CLASS NAME>,
            is_constant => 1,
        },
    ],
};
πŸ’€ heads up: keep that is_constant => 1 in there, it's doing the heavy lifting, she's the main character of this snippet.

show (optional)

Wanna add defaults to the show property? Say less. Do it like this:

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

Obsessed with how clean that is, ngl. πŸ“

helps (optional)

Overwrite the help_brief, help_synopsis and help_detail methods to provide your own specific help. Custom help is highkey a flex.

But listen β€” if you're overwriting the help_detail method, you gotta use call '_filter_doc' to get the filter documentation and usage, and then combine it with your own specific help. Don't skip that part, it's giving necessary. 🧚


🌈 List Styles 🌈

The styles you can list things in, periodt:

  • text
  • csv
  • html
  • xml
  • pretty (inprogress)
πŸ™ˆ yes, pretty is still (inprogress). She's a work in progress and we support her journey. Don't @ me.

That's the whole page, bestie β€” go forth and list things in like five different formats. πŸ’œ

Sign-off time: this one came from perl v5.32.1, dated 2022-01-17. Genuinely iconic of her. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from