Re: [systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run

2013-11-06 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Oct 31, 2013 at 04:26:23PM -0500, William Giokas wrote:
 On Thu, Oct 31, 2013 at 09:54:05PM +0100, Ronny Chevalier wrote:
  2013/10/31 William Giokas 1007...@gmail.com:
   Much better. Now one thing that would make this amazing is if you could
   make __machines an autoloaded file, possibly _sd_machines, that can be
   used in multiple zsh completions so that work doesn't have to be
   duplicated between this and _machinectl, similar to the work done with
   _sd_hosts_or_user_at_host. And possibly split this into two patches, one
   that just adds the -H/--host line and another that adds the -M/--machine
   line, the _sd_machines file and has _machinectl use _sd_machines.
  
   Just a thought.
  Yes okay, but I think we should keep this patch and send an other one
  which add the _sd_machines file, and use it in _systemd-run and
  _machinectl, like you said. Otherwise I don't see the point of a patch
  adding the host option, but not the other one missing.
  This second patch would also fix some other parts of the completion.
  Like in _systemd-nspawn where we could use _users for --user and make
  _outputmodes an autoloaded file, since both _journalctl and _systemctl
  use it.
 
 Okay. +1 from me.
Applied.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run

2013-10-31 Thread Ronny Chevalier
---
 shell-completion/zsh/_systemd-run | 17 +
 1 file changed, 17 insertions(+)

diff --git a/shell-completion/zsh/_systemd-run 
b/shell-completion/zsh/_systemd-run
index 0c81c54..4bfbd19 100644
--- a/shell-completion/zsh/_systemd-run
+++ b/shell-completion/zsh/_systemd-run
@@ -18,10 +18,27 @@ __slices () {
 _describe 'slices' _slices
 }
 
+__get_machines () {
+machinectl --full --no-pager list | {while read -r a b; do echo $a; 
done;};
+}
+
+__machines () {
+local -a _machines
+_machines=(${(fo)$(__get_machines)})
+typeset -U _machines
+if [[ -n $_machines ]]; then
+_describe 'machines' _machines
+else
+_message 'no machines'
+fi
+}
+
 _arguments \
 {-h,--help}'[Show help message]' \
 '--version[Show package version]' \
 '--user[Run as user unit]' \
+{-H+,--host=}'[Operate on remote 
host]:[user@]host:_sd_hosts_or_user_at_host' \
+{-M+,--machine=}'[Operate on local container]:machines:__machines' \
 '--scope[Run this as scope rather than service]' \
 '--unit=[Run under the specified unit name]:unit name' \
 '--description=[Description for unit]:description' \
-- 
1.8.4.2

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run

2013-10-31 Thread William Giokas
On Thu, Oct 31, 2013 at 08:46:29PM +0100, Ronny Chevalier wrote:
 ---
  shell-completion/zsh/_systemd-run | 17 +
  1 file changed, 17 insertions(+)
 
 diff --git a/shell-completion/zsh/_systemd-run 
 b/shell-completion/zsh/_systemd-run
 index 0c81c54..4bfbd19 100644
 --- a/shell-completion/zsh/_systemd-run
 +++ b/shell-completion/zsh/_systemd-run
 @@ -18,10 +18,27 @@ __slices () {
  _describe 'slices' _slices
  }
  
 +__get_machines () {
 +machinectl --full --no-pager list | {while read -r a b; do echo $a; 
 done;};
 +}
 +
 +__machines () {
 +local -a _machines
 +_machines=(${(fo)$(__get_machines)})
 +typeset -U _machines
 +if [[ -n $_machines ]]; then
 +_describe 'machines' _machines
 +else
 +_message 'no machines'
 +fi
 +}
 +

Much better. Now one thing that would make this amazing is if you could
make __machines an autoloaded file, possibly _sd_machines, that can be
used in multiple zsh completions so that work doesn't have to be
duplicated between this and _machinectl, similar to the work done with
_sd_hosts_or_user_at_host. And possibly split this into two patches, one
that just adds the -H/--host line and another that adds the -M/--machine
line, the _sd_machines file and has _machinectl use _sd_machines.

Just a thought.


  _arguments \
  {-h,--help}'[Show help message]' \
  '--version[Show package version]' \
  '--user[Run as user unit]' \
 +{-H+,--host=}'[Operate on remote 
 host]:[user@]host:_sd_hosts_or_user_at_host' \
 +{-M+,--machine=}'[Operate on local container]:machines:__machines' \
  '--scope[Run this as scope rather than service]' \
  '--unit=[Run under the specified unit name]:unit name' \
  '--description=[Description for unit]:description' \
 -- 
 1.8.4.2

Thanks,

-- 
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF


pgpO3fEnzM1YA.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run

2013-10-31 Thread Ronny Chevalier
2013/10/31 William Giokas 1007...@gmail.com:
 On Thu, Oct 31, 2013 at 08:46:29PM +0100, Ronny Chevalier wrote:
 ---
  shell-completion/zsh/_systemd-run | 17 +
  1 file changed, 17 insertions(+)

 diff --git a/shell-completion/zsh/_systemd-run 
 b/shell-completion/zsh/_systemd-run
 index 0c81c54..4bfbd19 100644
 --- a/shell-completion/zsh/_systemd-run
 +++ b/shell-completion/zsh/_systemd-run
 @@ -18,10 +18,27 @@ __slices () {
  _describe 'slices' _slices
  }

 +__get_machines () {
 +machinectl --full --no-pager list | {while read -r a b; do echo $a; 
 done;};
 +}
 +
 +__machines () {
 +local -a _machines
 +_machines=(${(fo)$(__get_machines)})
 +typeset -U _machines
 +if [[ -n $_machines ]]; then
 +_describe 'machines' _machines
 +else
 +_message 'no machines'
 +fi
 +}
 +

 Much better. Now one thing that would make this amazing is if you could
 make __machines an autoloaded file, possibly _sd_machines, that can be
 used in multiple zsh completions so that work doesn't have to be
 duplicated between this and _machinectl, similar to the work done with
 _sd_hosts_or_user_at_host. And possibly split this into two patches, one
 that just adds the -H/--host line and another that adds the -M/--machine
 line, the _sd_machines file and has _machinectl use _sd_machines.

 Just a thought.
Yes okay, but I think we should keep this patch and send an other one
which add the _sd_machines file, and use it in _systemd-run and
_machinectl, like you said. Otherwise I don't see the point of a patch
adding the host option, but not the other one missing.
This second patch would also fix some other parts of the completion.
Like in _systemd-nspawn where we could use _users for --user and make
_outputmodes an autoloaded file, since both _journalctl and _systemctl
use it.



  _arguments \
  {-h,--help}'[Show help message]' \
  '--version[Show package version]' \
  '--user[Run as user unit]' \
 +{-H+,--host=}'[Operate on remote 
 host]:[user@]host:_sd_hosts_or_user_at_host' \
 +{-M+,--machine=}'[Operate on local container]:machines:__machines' \
  '--scope[Run this as scope rather than service]' \
  '--unit=[Run under the specified unit name]:unit name' \
  '--description=[Description for unit]:description' \
 --
 1.8.4.2

 Thanks,

 --
 William Giokas | KaiSforza | http://kaictl.net/
 GnuPG Key: 0x73CD09CF
 Fingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF

 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v2] zsh-completion: add missing options for systemd-run

2013-10-31 Thread William Giokas
On Thu, Oct 31, 2013 at 09:54:05PM +0100, Ronny Chevalier wrote:
 2013/10/31 William Giokas 1007...@gmail.com:
  Much better. Now one thing that would make this amazing is if you could
  make __machines an autoloaded file, possibly _sd_machines, that can be
  used in multiple zsh completions so that work doesn't have to be
  duplicated between this and _machinectl, similar to the work done with
  _sd_hosts_or_user_at_host. And possibly split this into two patches, one
  that just adds the -H/--host line and another that adds the -M/--machine
  line, the _sd_machines file and has _machinectl use _sd_machines.
 
  Just a thought.
 Yes okay, but I think we should keep this patch and send an other one
 which add the _sd_machines file, and use it in _systemd-run and
 _machinectl, like you said. Otherwise I don't see the point of a patch
 adding the host option, but not the other one missing.
 This second patch would also fix some other parts of the completion.
 Like in _systemd-nspawn where we could use _users for --user and make
 _outputmodes an autoloaded file, since both _journalctl and _systemctl
 use it.

Okay. +1 from me.

-- 
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306  E6B8 6902 06D8 73CD 09CF


pgpCZQ9bTL_qy.pgp
Description: PGP signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel