Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: alias -g -> SOLVED



NICE

Thanks Bart

- Eric Smith

> However, you may be able to get what you want via preexec_functions.
> 
>  auto_translate() {
>    local -a commandline
>    commandline=( ${(z)1} )
>    if [[ $commandline[-1] == T ]]
>    then
>      print -R "${commandline[0,-2]}" | translate
>    fi
>  }
> 
>  # Important that this comes after function definition
>  alias -g T='${auto_translate?command execution suppressed}'
> 
>  # Set auto_translate to the empty string to both translate
>  # and then execute the original command anyway
>  unset auto_translate	# Force T alias to abort
>  preexec_functions+=( auto_translate )
> 



Messages sorted by: Reverse Date, Date, Thread, Author