-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcsprocessor.bash
More file actions
123 lines (115 loc) · 4.47 KB
/
csprocessor.bash
File metadata and controls
123 lines (115 loc) · 4.47 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# csprocessor completion
_csprocessor()
{
local cur prev commands options build_options command
COMPREPLY=()
cur=`_get_cword`
commands='add-revision assemble build checkout create edit info list preview publish pull pull-snapshot push push-translation revisions search setup snapshot status sync-translation template validate'
if [[ $COMP_CWORD -eq 1 ]] ; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--host --config --help --username' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
fi
else
prev=${COMP_WORDS[COMP_CWORD-1]}
case $prev in
--config)
_filedir 'ini'
return 0;
;;
@(--host|-H))
COMPREPLY=( $( compgen -A hostname "$cur" ) )
return 0;
;;
--zanata-server)
COMPREPLY=( $( compgen -A hostname "$cur" ) )
return 0;
;;
@(--output|-o))
COMPREPLY=( $( compgen -df "$cur" ) )
return 0;
;;
--format)
COMPREPLY=( $( compgen -W "publican publican-po jdocbook" -- "$cur" ) )
return 0;
;;
--override)
COMPREPLY=( $( compgen -W "Author_Group.xml= Revision_History.xml= Feedback.xml= revnumber= brand= pubsnumber=" "$cur" ) )
compopt -o nospace
return 0;
;;
esac
command=${COMP_WORDS[1]}
build_options='--hide-errors --show-contentspec --hide-injections --override --publican.cfg-override --injection-types --hide-bug-links --old-bug-links --force-bug-links --output --editor-links --lang --target-lang --show-report --fetch-pubsnum --revision --latest --draft --show-remarks --rev-message --flatten-topics --flatten --yes --format --skip-bug-link-validation --suggest-chunk-depth --fail-on-build-error --fail-on-build-warning --disable-ssl-cert --zanata-server --zanata-project --zanata-version'
if [[ "$cur" == -* ]]; then
# possible options for the command
case $command in
add-revision)
options='--date --email --firstname --rev-message --revnumber --surname'
;;
assemble)
options="$build_options --no-build --hide-output --no-publican-build --publican-config"
;;
build)
options=$build_options
;;
checkout)
options='--force --zanata-server --zanata-project --zanata-version'
;;
create)
options='--no-csprocessor-cfg --force --message --rev-history --strict-titles'
;;
edit)
options='--content-spec --topic --rev-history --lang'
;;
list)
options='--limit'
;;
preview)
options="$build_options --no-build --hide-output --no-publican-build --publican-config --no-assemble"
;;
publish)
options="$build_options --no-build --hide-output --no-publican-build --publican-config --no-assemble --pub-message"
;;
pull)
options='--content-spec --topic --revision --output'
;;
pull-snapshot)
options='--revision --max-topic-revision --output --latest'
;;
push)
options='--push-only --message --rev-history --strict-titles'
;;
push-translation)
options='--zanata-server --zanata-project --zanata-version --disable-copytrans --disable-ssl-cert --yes --unfrozen-push --contentspec-only'
;;
revisions)
options='--content-spec --topic'
;;
snapshot)
options='--max-topic-revision --latest --new --message --rev-history'
;;
sync-translation)
options='--langs --zanata-server --zanata-project --zanata-version --disable-ssl-cert'
;;
template)
options='--commented --output'
;;
validate)
options='--strict-titles'
;;
esac
options="$options --host --config --help"
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
if [[ "$command" == @(--help) ]]; then
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
else
_filedir
fi
fi
fi
return 0
}
complete -F _csprocessor csprocessor