OCA-Creations / Ally

A powerful command-line tool for managing ZSH aliases, written in Swift.
MIT License
2 stars 0 forks source link

[FEATURE REQUEST] Allow using `=` in the `add` command #3

Closed MrDevel0per closed 12 months ago

MrDevel0per commented 1 year ago

Is your feature request related to a problem? Please describe. No. While there is an error produced when one uses an = sign and doesn't follow command format, this is expected behavior.

Solution

Background In the .ally file, and indeed in a .zshrc, an alias is declared with an = sign. For example, to alias git commit -m to gm, the .ally file would say:

alias gm='git commit -m'

However, that's not how ally works, but it is how calling alias from the command line works. So if you wanted to add this in ally, you would have to say: ally add gm 'git commit -m'. However, if you try to add it with an equals:

> ally add gm='git commit -m'
Error: Missing expected argument '<command>'
Help:  <command>  The long-form command to be aliased to `alias`.
Usage: ally add [--no-reload] [--no-output] <alias> <command>
  See 'ally add --help' for more information.

Support Equals Signs!

So, we need to support this equals syntax. The way to do this is to take the input to add as one command, and then parse it based on whether it contains an equals sign.

Describe alternatives you've considered None.