Пример #1
0
static void write_cshcompl(FILE *out,
			   int nfile,  t_filenm *fnm,
			   int npargs, t_pargs *pa)
{
  fprintf(out,"complete %s",ShortProgram());
  pr_enums(out,npargs,pa,eshellCSH);
  pr_fopts(out,nfile,fnm,eshellCSH);
  pr_opts(out,nfile,fnm,npargs,pa,eshellCSH);
  fprintf(out,"\n");
}
Пример #2
0
static void write_zshcompl(FILE *out,
			   int nfile,  t_filenm *fnm,
			   int npargs, t_pargs *pa)
{
  fprintf(out,"compctl ");

  /* start with options, since they are always present */
  pr_opts(out,nfile,fnm,npargs,pa,eshellZSH);
  pr_enums(out,npargs,pa,eshellZSH);
  pr_fopts(out,nfile,fnm,eshellZSH);
  fprintf(out,"-- %s\n",ShortProgram());
}
Пример #3
0
static void write_bashcompl(FILE *out,
			    int nfile,  t_filenm *fnm,
			    int npargs, t_pargs *pa)
{
  /* Advanced bash completions are handled by shell functions.
   * p and c hold the previous and current word on the command line.
   * We need to use extended globbing, so write it in each completion file */
  fprintf(out,"shopt -s extglob\n");
  fprintf(out,"_%s_compl() {\nlocal p c\n",ShortProgram());
  fprintf(out,"COMPREPLY=() c=${COMP_WORDS[COMP_CWORD]} p=${COMP_WORDS[COMP_CWORD-1]}\n");
  pr_opts(out,nfile,fnm,npargs,pa,eshellBASH);
  fprintf(out,"case \"$p\" in\n");
  pr_enums(out,npargs,pa,eshellBASH);
  pr_fopts(out,nfile,fnm,eshellBASH);
  fprintf(out,"esac; }; \ncomplete -F _%s_compl %s\n",ShortProgram(),ShortProgram());
}