[systemd-devel] [PATCH 1/2] systemd-helpers

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Jan 28 21:50:20 PST 2015


On Sat, Jan 10, 2015 at 01:33:05PM +0100, Carlos Morata Castillo wrote:
> Hi,
> 
> As stated here, we should use a library for bash autocompletions (maybe even with include guards).
> http://cgit.freedesktop.org/systemd/systemd/commit/shell-completion/bash/localectl?id=a72d698d0d9ff9c158155b44cdc77376df31a317
> 
> Explanation:
> 
> Using autotools make the autocompletions to /usr/share/bash-completions/completions (as the exit from pkg-config --variable=completionsdir
> bash-completion).
> We ended up having multiple function definitions and even messing around with the global bash function namespace, as the functions are called
> __get_something being possible to redefine other binary bash function. 
> 
> With this patch:
> 1- All the files in bash completions, except busctl and systemctl.in, use this common library.
> 2- They are prefixed with the namespace __systemdh.

The diffstat looks nice. But the inclusion of the library file needs
to be fixed. Two possibilites:

1. m4 macros at compile time
2. include the library file using the full absolute path (specified as @VARIABLE@),
   and also substitute this at compile time. I think this might be a nicer option,
   since m4 messes with the syntax too much.

   See how systemctl.in defines the path to /usr/lib/systmed/systemd.

Zbyszek

> ---
>  shell-completion/bash/bootctl             | 12 ++---
>  shell-completion/bash/coredumpctl         | 21 ++++----
>  shell-completion/bash/hostnamectl         | 14 ++----
>  shell-completion/bash/journalctl          | 10 ++--
>  shell-completion/bash/localectl           | 18 +++----
>  shell-completion/bash/loginctl            | 36 ++++++--------
>  shell-completion/bash/machinectl          | 26 ++++------
>  shell-completion/bash/systemd-analyze     | 31 ++++--------
>  shell-completion/bash/systemd-cat         | 10 ++--
>  shell-completion/bash/systemd-cgls        | 17 ++-----
>  shell-completion/bash/systemd-cgtop       |  8 +--
>  shell-completion/bash/systemd-delta       | 10 ++--
>  shell-completion/bash/systemd-detect-virt |  8 +--
>  shell-completion/bash/systemd-helpers     | 83 +++++++++++++++++++++++++++++++
>  shell-completion/bash/systemd-nspawn      | 43 +++-------------
>  shell-completion/bash/systemd-run         | 60 ++++++++++------------
>  shell-completion/bash/timedatectl         | 18 +++----
>  shell-completion/bash/udevadm             | 20 +++-----
>  Makefile.am                               | 1 +
>  19 files changed, 206 insertions(+), 240 deletions(-)
>  create mode 100644 shell-completion/bash/systemd-helpers
> 


More information about the systemd-devel mailing list