tsonobe1 / dotfiles

0 stars 0 forks source link

How to pass arguments to gitconfig alias. #5

Open tsonobe1 opened 3 years ago

tsonobe1 commented 3 years ago

ref https://qiita.com/YamEiR/items/d98ba009d2925e7eb305

How to pass arguments

use function & $number

alias =  'f(){command $1  command $2; };f'

How to pass a string containing whitespace as an argument.

Surround $number with \” $number \”.

alias = 'f() command \"$1\"  command \"$2\";} :f'

user single quote

$ alias 'string' 'string'
tsonobe1 commented 3 years ago

sample

Originally

 $ gh issue create --title "title" -b "body"

alias

adis = !"f(){ gh issue create --title \"$1\" -b \"$2\"; };f"

How to use

git adis "How to pass arguments to gitconfig alias."   "Body ~~"

! at the beginning of the alias to replace the git ~ command with an external command.