2

I'm trying to replace vlc with the more intuitive watch command.

desired functionality

  1. Autocompletion

    watch /path/to/mo Tab --> watch /path/to/movie.avi

  2. Execute vlc

    watch /path/to/movie.avi Enter # this should run `vlc /path/to/movie.avi

Currently I'm using an alias todo above :

~/.bashrc

...
alias watch='vlc'
...

This meets execute vlc above, but doesn't give the correct autocompletion [ 1 ]

current behaviour

$ vlc /path/to/mo Tab --> vlc /path/to/movie.avi ( successfully completing )

$ watch /path/to/mo Tab --> watch /path/to/mo ( not autocompleting.. )

As @GUIDO mentions, watch is an inbuilt command. This is somehow affecting the autocomplete. Changing to play works, but would like to understand why this doesnt work, and how to fix..

note

similar to How do I get bash completion to work with aliases?

but defining the function wrap_alias ( in my ~/.bashrc ) and calling

wrap_alias watch vlc ''

doesn't fix the autocomplete issue

Community
  • 1
  • 1
amdixon
  • 3,814
  • 8
  • 25
  • 34
  • 1
    are you aware that `watch` is a command present already in most if not all linux distributions by default? – guido May 24 '15 at 03:34
  • possible duplicate of [How do I get bash completion to work with aliases?](http://stackoverflow.com/questions/342969/how-do-i-get-bash-completion-to-work-with-aliases) – pasaba por aqui May 24 '15 at 09:06
  • @pasabaporaqui the wrap_alias in that answer does not solve the issue – amdixon May 24 '15 at 09:36

1 Answers1

7

If we look at the completion for command 'vlc' we see:

$ complete | grep vlc
complete -F _minimal vlc

so the wrapper function is "_minimal". We can use the same for the new command:

$ alias watch='vlc'
$ complete -F _minimal watch 

and subject must be now solved.

pasaba por aqui
  • 3,446
  • 16
  • 40