@@ -33,14 +33,20 @@ protected function configure()
3333 ->addOption (
3434 'generate-hook ' ,
3535 'g ' ,
36- InputOption::VALUE_OPTIONAL ,
36+ InputOption::VALUE_NONE ,
3737 'Generate BASH code that sets up completion for this application. '
3838 )
3939 ->addOption (
4040 'program ' ,
4141 'p ' ,
4242 InputOption::VALUE_REQUIRED ,
4343 "Program name that should trigger completion \n<comment>(defaults to the absolute application path)</comment>. "
44+ )
45+ ->addOption (
46+ 'shell-type ' ,
47+ null ,
48+ InputOption::VALUE_OPTIONAL ,
49+ 'Set the shell type (zsh or bash). Otherwise this is determined automatically. '
4450 );
4551 }
4652
@@ -55,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5561
5662 $ factory = new HookFactory ();
5763 $ hook = $ factory ->generateHook (
58- $ input ->getOption ('generate-hook ' ) ?: $ this ->getShellType (),
64+ $ input ->getOption ('shell-type ' ) ?: $ this ->getShellType (),
5965 $ program ,
6066 $ input ->getOption ('program ' )
6167 );
@@ -79,10 +85,10 @@ protected function runCompletion()
7985 protected function getShellType ()
8086 {
8187 if (!getenv ('SHELL ' )) {
82- throw new \RuntimeException ('Could not read SHELL environment variable. Please specify your shell type as an argument to the --generate-hook option. ' );
88+ throw new \RuntimeException ('Could not read SHELL environment variable. Please specify your shell type using the --shell-type option. ' );
8389 }
8490
85- return basename (realpath ( getenv ('SHELL ' ) ));
91+ return basename (getenv ('SHELL ' ));
8692 }
8793
8894}
0 commit comments