Re: [systemd-devel] [PATCH] Updates in bash autocompletions

2015-01-28 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Jan 10, 2015 at 02:08:21AM +0100, Carlos Morata Castillo wrote:
 Hi,
 
 I did ./check-undocumented.sh -b (my script just submitted) and checked
 the results.
 
 
 Cheers.

 
 ---
  shell-completion/bash/coredumpctl |  2 +-
  shell-completion/bash/hostnamectl |  2 +-
  shell-completion/bash/journalctl  | 11 ++-
  shell-completion/bash/localectl   |  2 +-
  shell-completion/bash/loginctl|  7 ---
  shell-completion/bash/systemd-analyze |  2 +-
  shell-completion/bash/systemd-cgtop   |  3 ++-
  shell-completion/bash/timedatectl |  2 +-
  8 files changed, 17 insertions(+), 14 deletions(-)
 
 diff --git a/shell-completion/bash/coredumpctl 
 b/shell-completion/bash/coredumpctl
 index e23152d..6091677 100644
 --- a/shell-completion/bash/coredumpctl
 +++ b/shell-completion/bash/coredumpctl
 @@ -37,7 +37,7 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY 
 CODE_{FILE,LINE,FUNC}
  _coredumpctl() {
  local i verb comps
  local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
 -local OPTS='-h --help --version --no-pager --no-legend -o --output 
 -F --field'
 +local OPTS='-h --help --version --no-pager --no-legend -o --output 
 -F --field -1'
  
  local -A VERBS=(
  [LIST]='list'
 diff --git a/shell-completion/bash/hostnamectl 
 b/shell-completion/bash/hostnamectl
 index 7a0850d..9ad52e0 100644
 --- a/shell-completion/bash/hostnamectl
 +++ b/shell-completion/bash/hostnamectl
 @@ -28,7 +28,7 @@ _hostnamectl() {
  local i verb comps
  local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
  local OPTS='-h --help --version --transient --static --pretty
 ---no-ask-password -H --host'
 +--no-ask-password -H --host --machine'
Hm, this needs more work, since --machine should complete to an arg.

  
  if [[ $cur = -* ]]; then
  COMPREPLY=( $(compgen -W '${OPTS[*]}' -- $cur) )
 diff --git a/shell-completion/bash/journalctl 
 b/shell-completion/bash/journalctl
 index 14dcd22..57b4591 100644
 --- a/shell-completion/bash/journalctl
 +++ b/shell-completion/bash/journalctl
 @@ -44,14 +44,15 @@ _journalctl() {
--disk-usage -f --follow --header
-h --help -l --local --new-id128 -m --merge 
 --no-pager
--no-tail -q --quiet --setup-keys --this-boot 
 --verify
 -  --version --list-catalog --update-catalog 
 --list-boots'
 +  --version --list-catalog --update-catalog 
 --list-boots --show-cursor
 +  --dmesg -k --pager-end -e -r --reverse --utc 
 -x --catalog --no-full --force --dump-catalog --flush'
 [ARG]='-b --boot --this-boot -D --directory --file -F 
 --field
 -  -o --output -u --unit --user-unit -p 
 --priority'
 -[ARGUNKNOWN]='-c --cursor --interval -n --lines --since 
 --until
 -  --verify-key'
 +  -o --output -u --unit --user-unit -p 
 --priority --machine 
 +-c --cursor --interval -n --lines --since --until 
 --after-cursor 
 +--verify-key --identifier --root'
The split between ARG and ARGUNKNOWN was there for a reason. For the
latter we cannot provide completions. This is a kind of internal
documentation, please do not remove this.

Also, you patch adds whitespace at the end of lines here.
If you run ./autogen.sh, it'll install a git hook which will tell you about
such issues.

I applied the patch with some small tweaks.

  )
  
 -if __contains_word $prev ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
 +if __contains_word $prev ${OPTS[ARG]}; then
  case $prev in
  --boot|--this-boot|-b)
  comps=$(journalctl -F '_BOOT_ID' 2/dev/null)
 diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl
 index c9e22af..e0c06a7 100644
 --- a/shell-completion/bash/localectl
 +++ b/shell-completion/bash/localectl
 @@ -34,7 +34,7 @@ _localectl() {
  local i verb comps locale_vals
  local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
  local OPTS='-h --help --version --no-convert --no-pager 
 --no-ask-password
 --H --host'
 +-H --host --machine'
Again, --machine needs arg completiion.

  
  if __contains_word $prev $OPTS; then
  case $prev in
 diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl
 index e7adb93..ea277c6 100644
 --- a/shell-completion/bash/loginctl
 +++ b/shell-completion/bash/loginctl
 @@ -33,9 +33,10 @@ _loginctl () {
  local i verb comps
  
  local -A OPTS=(
 -   [STANDALONE]='--all -a --help -h --no-pager --privileged -P 
 

[systemd-devel] [PATCH] Updates in bash autocompletions

2015-01-09 Thread Carlos Morata Castillo
Hi,

I did ./check-undocumented.sh -b (my script just submitted) and checked
the results.


Cheers.
---
 shell-completion/bash/coredumpctl |  2 +-
 shell-completion/bash/hostnamectl |  2 +-
 shell-completion/bash/journalctl  | 11 ++-
 shell-completion/bash/localectl   |  2 +-
 shell-completion/bash/loginctl|  7 ---
 shell-completion/bash/systemd-analyze |  2 +-
 shell-completion/bash/systemd-cgtop   |  3 ++-
 shell-completion/bash/timedatectl |  2 +-
 8 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/shell-completion/bash/coredumpctl b/shell-completion/bash/coredumpctl
index e23152d..6091677 100644
--- a/shell-completion/bash/coredumpctl
+++ b/shell-completion/bash/coredumpctl
@@ -37,7 +37,7 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
 _coredumpctl() {
 local i verb comps
 local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
-local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field'
+local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1'
 
 local -A VERBS=(
 [LIST]='list'
diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl
index 7a0850d..9ad52e0 100644
--- a/shell-completion/bash/hostnamectl
+++ b/shell-completion/bash/hostnamectl
@@ -28,7 +28,7 @@ _hostnamectl() {
 local i verb comps
 local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
 local OPTS='-h --help --version --transient --static --pretty
---no-ask-password -H --host'
+--no-ask-password -H --host --machine'
 
 if [[ $cur = -* ]]; then
 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- $cur) )
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl
index 14dcd22..57b4591 100644
--- a/shell-completion/bash/journalctl
+++ b/shell-completion/bash/journalctl
@@ -44,14 +44,15 @@ _journalctl() {
   --disk-usage -f --follow --header
   -h --help -l --local --new-id128 -m --merge --no-pager
   --no-tail -q --quiet --setup-keys --this-boot --verify
-  --version --list-catalog --update-catalog --list-boots'
+  --version --list-catalog --update-catalog --list-boots --show-cursor
+  --dmesg -k --pager-end -e -r --reverse --utc -x --catalog --no-full --force --dump-catalog --flush'
[ARG]='-b --boot --this-boot -D --directory --file -F --field
-  -o --output -u --unit --user-unit -p --priority'
-[ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until
-  --verify-key'
+  -o --output -u --unit --user-unit -p --priority --machine 
+-c --cursor --interval -n --lines --since --until --after-cursor 
+--verify-key --identifier --root'
 )
 
-if __contains_word $prev ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
+if __contains_word $prev ${OPTS[ARG]}; then
 case $prev in
 --boot|--this-boot|-b)
 comps=$(journalctl -F '_BOOT_ID' 2/dev/null)
diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl
index c9e22af..e0c06a7 100644
--- a/shell-completion/bash/localectl
+++ b/shell-completion/bash/localectl
@@ -34,7 +34,7 @@ _localectl() {
 local i verb comps locale_vals
 local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
 local OPTS='-h --help --version --no-convert --no-pager --no-ask-password
--H --host'
+-H --host --machine'
 
 if __contains_word $prev $OPTS; then
 case $prev in
diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl
index e7adb93..ea277c6 100644
--- a/shell-completion/bash/loginctl
+++ b/shell-completion/bash/loginctl
@@ -33,9 +33,10 @@ _loginctl () {
 local i verb comps
 
 local -A OPTS=(
-   [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version'
-  [ARG]='--host -H --kill-who --property -p --signal -s'
-)
+   [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version 
+   --no-legend --no-ask-password -l --full'
+  [ARG]='--host -H --kill-who --property -p --signal -s --machine'
+  )
 
 if __contains_word $prev ${OPTS[ARG]}; then
 case $prev in
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 77d1b54..0094702 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -36,7 +36,7 @@ _systemd_analyze() {