Skip to content

Instantly share code, notes, and snippets.

@yutailang0119
Created October 11, 2018 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yutailang0119/0c9c57b894c478d7f679b2990c3a995d to your computer and use it in GitHub Desktop.
Save yutailang0119/0c9c57b894c478d7f679b2990c3a995d to your computer and use it in GitHub Desktop.
Fish shell function that open file by Android Studio
~/.config/fish/functions/studio.fish
function studio -d "Open file by Android Studio"
set -l file $argv[1]
set -l a_option $argv[2]
set -l application $argv[3]
if test -z $a_option
set a_option -a
set application 'Android Studio'
else if test $a_option != -a
echo "Error: Option supports only '-a'"
return 1
else if test -z $application
echo "Error: Need to specify Android Studio when using -a option"
return 1
end
set -l match_pattern (string match -nr 'Android Studio' $application)
if test \( -z $match_pattern \) -o \( $match_pattern != '1 14' \)
echo "Error: Only application with 'Android Studio' prefix are supported"
return 1
end
open $file $a_option $application
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment