| 1 | package App::SD::CLI::Command::Help::Aliases; | ||
| 2 | use Any::Moose; | ||
| 3 | extends 'App::SD::CLI::Command::Help'; | ||
| 4 | |||
| 5 | sub run { | ||
| 6 | my $self = shift; | ||
| 7 | $self->print_header('Command Aliases'); | ||
| 8 | my ${cmd}= $self->cli->get_script_name; | ||
| 9 | |||
| 10 | print <<EOF | ||
| 11 | |||
| 12 | You can create custom command aliases in the aliases section of | ||
| 13 | your local configuration files. The format is as follows: | ||
| 14 | |||
| 15 | [alias] | ||
| 16 | command to type = command to translate it to | ||
| 17 | |||
| 18 | As an example, you could create an alias to show all tickets assigned | ||
| 19 | to you with the alias 'mine': | ||
| 20 | |||
| 21 | mine = ticket list -- owner=you\@domain.com status !~closed|rejected | ||
| 22 | |||
| 23 | By default, any additional arguments to aliases are appended to the | ||
| 24 | replacement text, so you can write something like | ||
| 25 | |||
| 26 | alias tl = ticket list | ||
| 27 | |||
| 28 | and | ||
| 29 | |||
| 30 | tl -- owner=you\@domain.com | ||
| 31 | |||
| 32 | will work like you expect. In order to do more complicated things with | ||
| 33 | arguemnts, you can use the number of an argument, prefixed by a '\$', | ||
| 34 | like this: | ||
| 35 | |||
| 36 | ts = ticket show \$1 -s | ||
| 37 | |||
| 38 | SD also provides a command for managing aliases: '${cmd}aliases'. If | ||
| 39 | given no arguments, the aliases command will print the active aliases | ||
| 40 | for the current repository (including all non-overridden user-wide | ||
| 41 | and global aliases, if any). '${cmd}aliases edit' will present you with an | ||
| 42 | editor window in which aliases can be modified. Aliases will be saved to your | ||
| 43 | local configuration file when editing is done. | ||
| 44 | |||
| 45 | Examples (in all examples, 'alias' can be used anywhere 'aliases' appears | ||
| 46 | and vice-versa): | ||
| 47 | |||
| 48 | ${cmd}aliases | ||
| 49 | ${cmd}aliases show | ||
| 50 | Show currently active aliases. | ||
| 51 | |||
| 52 | ${cmd}aliases edit | ||
| 53 | Edit aliases in an editor window. | ||
| 54 | |||
| 55 | ${cmd}alias "command to type" "command to translate to" | ||
| 56 | Set the given alias (or change it if it already exists). | ||
| 57 | |||
| 58 | ${cmd}aliases delete "command to type" | ||
| 59 | Delete the given alias. | ||
| 60 | |||
| 61 | The --user and --global arguments can be used in conjunction with the | ||
| 62 | set (and edit) commands to change what configuration file to use. | ||
| 63 | By default, the repository-specific configuration file is used. | ||
| 64 | |||
| 65 | For more information on local configuration files, see '${cmd}help config'. | ||
| 66 | |||
| 67 | EOF | ||
| 68 | |||
| 69 | } | ||
| 70 | |||
| 71 | __PACKAGE__->meta->make_immutable; | ||
| 72 | no Any::Moose; | ||
| 73 | |||
| 74 | 1; | ||
| 75 |