forked from Bisa/factorio-init
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash_autocomplete
More file actions
30 lines (27 loc) · 747 Bytes
/
bash_autocomplete
File metadata and controls
30 lines (27 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
_factorio()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# basic options
opts=`factorio listcommands 2> /dev/null`
# command arguments
case "${prev}" in
chatlog)
COMPREPLY=( $(compgen -W "-t --tail" -- ${cur}) )
return 0
;;
update)
COMPREPLY=( $(compgen -W "--dry-run" -- ${cur}) )
return 0
;;
new-game|load-save|save-game)
COMPREPLY=( $(compgen -W "`factorio listsaves 2> /dev/null`" -- ${cur}) )
return 0
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
}
complete -F _factorio factorio