Replies: 2 comments 11 replies
-
Why should this be limited to just one CLI tool? I am using my own opcode, which has exactly the functionality you are describing (quickly adding aliases by a simple command) and the file format you are describing ( Although this can be implemented as a library, to add to your own bash script - I am not entirely sure it should be a built in library, as the functionality is quite specific. |
Beta Was this translation helpful? Give feedback.
-
This should also be in a filter if [[ -n "${RUN_ALIAS_CALLED:-}" ]]; then
echo "invalid command: $alias" >&2
exit 1
fi either in the same filter, or another Of course, you can do the filtering in your command code as you did, but I would want to stick to the design principles of bashly that encourages you to only have the actual command code in the command file. Your command code can be as simple as this: alias="${ARGS[alias]}"
aliased_command=($(get_aliased_command "${alias}"))
export RUN_ALIAS_CALLED=true
run "${aliased_command[@]}" "${OTHER_ARGS[@]}" |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sharing only the idea. Not really sure about how to implement this...
If not possible to implement as a native bashly thing (or a lib), any tip about how to achieve this would be appreciated.
idea
Allow users easily create command specific aliases.
Example of ideal usage:
existing example
The
glab
GitLab CLI has a quite handy subcommand calledalias
that allows the user to create glab-specific aliases.Aliases are created like this:
Now when I want to push the current commit and create a Merge Request assigned to me, I can simply run
glab mrcreate
(rather than that long command).The
alias
subcommands are:The aliases are usually persisted in
~/.config/glab-cli/aliases.yml
that has only key-value pairs, like this:Beta Was this translation helpful? Give feedback.
All reactions