Skip to content

Instantly share code, notes, and snippets.

@danyspin97
Created May 9, 2018 22:28
Show Gist options
  • Save danyspin97/cc2452d727bfeefdb831d115238a5802 to your computer and use it in GitHub Desktop.
Save danyspin97/cc2452d727bfeefdb831d115238a5802 to your computer and use it in GitHub Desktop.
run = [cmd]{
use re
help-message = ( asciinema -h | sed -n '7,11p; 12q' | grep " "$cmd" " )
display-suffix = ( echo ( re:split &longest=$true &max=3 ' +' $help-message ) | cut -d ' ' -f 3- )
edit:complex-candidate &code-suffix='' &display-suffix=" "$display-suffix &style='' $cmd
}
fn asciinema-completer [asciinema-args @rest]{
n = (count $rest)
if (eq $n 1) {
commands = [auth cat play rec upload]
t = [ ]
for cmd $commands {
t = [ $@t { $run $cmd } ]
}
run-parallel $@t
}
}
edit:completion:arg-completer[asciinema] = $asciinema-completer~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment