GiselleSerate / myaliases

Useful shell aliases and functions.
6 stars 1 forks source link

ensure that the proper number of arguments are being passed #39

Closed GiselleSerate closed 6 years ago

GiselleSerate commented 6 years ago

You'll have to do this with regexes because people usually have spaces in quotes and weird stuff like that. Only do this check if the flag is present. If it is compliant with the regex, continue; if not, break.

GiselleSerate commented 6 years ago

Possible forms:

alias pies='commands and stuff'
addalias limes="more commands"
alias 'dadhats'="do stuff"
addalias "snapbacks"='wow this is exciting'

Structure

call: lower/upper alphabetic space: at least one nickname: bookended by matching ' or ", lower/upper alphanumeric and underscore =: match identically commands: bookended by matching ' or ", some combination of any characters (.*)

Edge cases to be concerned about:

Figure out:

How do you use k regex anyhow?

GiselleSerate commented 6 years ago

Now that we are using the altalias strategy as referenced in #46, things have changed.

GiselleSerate commented 6 years ago

I put garbage in and it says:

1
-bash: alias: erwiojgklelkmw: not found
Creating new permanent alias: alias aha='new command'

Then it dumps the current aliases into the terminal, which isn't, like, awful. (I need to get rid of that number, btw, wherever that's coming from, and I don't know what permanent alias it's trying to make with aha='new command'.)

GiselleSerate commented 6 years ago

Fixed as of commit 9cd23c903005b0b9ac2e4a3ded004bdbddaa5745.