Commit graph

27 commits

Author SHA1 Message Date
Arthur Zamarin 3eb329bfb5
shell completion: fix machinectl import-{tar,raw}
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
2024-04-26 12:10:30 +03:00
Jan Macku f8457290c4 fix(SC2148): add ShellCheck directive to bash completion scripts 2024-02-27 15:41:28 +01:00
Zbigniew Jędrzejewski-Szmek 4e9183059a shell-completion/zsh: silence error when machinectl is not installed
This fixes a few unrelated issues:
- when ENABLE_MACHINED is false, machinectl is not installed, but _sd_machines
  is still used in a few places that want to complete -M and such.
  Also, bash completion calls machinectl in various places.
  Make missing machinectl mean "no machines" in this case, so
  that no error is generated in the callers.
- machinectl list --full would print multiple lines of output per machine,
  breaking grep, issue introduced in e2268fa437.
  Using --max-addresses=1 would fix the issue, but let's use
  --max-addresses=0 because we now can.
- the lists used in various places were slightly different for no good reason.
- don't use a subshell if not necessary.

The code for bash still uses the same combined list of images and running
machines for various commands. The zsh code uses images for start/clone, and
running machines for the rest. Maybe something to fix in the future.

Replaces #25048.
2022-10-20 09:58:00 +02:00
Zbigniew Jędrzejewski-Szmek 4ccde410a3 tree-wide: change --kill-who to --kill-whom
getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and
people can use --kill-who (or even shorter abbreviations). English is flexible,
so in common speach people would use both forms, even if "whom" is technically
more correct. The advantage of using the longer form in the code is that we
effectively allow both forms, so we stop punishing people who DTGCT¹, but still
allow people to use the spoken form if they prefer.

1. Do the gramatically correct thing
2022-08-26 11:15:44 +09:00
Michael Biebl 85fce6f42c Use https for gnu.org 2022-06-28 16:07:35 +02:00
Luca Boccassi 36ec026830 completion: fix 'unbound variables' errors
Fixes https://github.com/systemd/systemd/issues/19987
2021-06-22 14:56:47 +01:00
Sibo Dong f34173a048 bash-completion: localize words and cword variables
The words and cword variables are not localized in all Bash completion
scripts that call _init_completion.

cur, prev, words, and cword (and split if using the -s flag) are all
variables that should be localized in Bash completion scripts before
calling _init_completion (even if they don't otherwise appear in the
calling script). This is done for cur and prev, but not for words and
cword. Letting words and cword remain unlocalized may clobber variables
the user is using for other purposes, which is bad.

This issue can be resolved by declaring words and cword as local
variables.

Resolves #19188.
2021-04-06 16:15:13 +02:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Yu Watanabe e2268fa437 bash-completion: do not ellipsize machine name 2020-01-10 12:29:02 +09:00
Zbigniew Jędrzejewski-Szmek 843cfcb15c shell-completion: use 4 space indentation too
The same as in other places, indentation levels were all over the place.
2019-04-12 08:34:44 +02:00
Yu Watanabe fad73e9deb bash-completion: machinectl: suggest arguments for --verify and --format
This also changes to use '--output=help' for suggesting arguments of
--output option.
2018-12-14 02:18:24 +09:00
Yu Watanabe 0e5bea97e9 bash-completion: machinectl: support import-fs 2018-12-14 01:52:48 +09:00
Lennart Poettering 8e04444385 journalctl: port JSON output mode to new JSON API
Also, while we are at it, beef it up, by adding json-seq support (i.e.
https://tools.ietf.org/html/rfc7464). This is particularly useful in
conjunction with jq's --seq switch.
2018-10-11 17:25:27 +02:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Yu Watanabe 6d92077e39 bash-completion: machinectl: add missing options and verbs 2018-01-10 23:17:32 +09:00
Zbigniew Jędrzejewski-Szmek 7059062c2f Add SPDX license headers to shell completion scripts 2017-11-19 19:08:15 +01:00
Christian Rebischke b2bb19bbda machinectl: Added stop as alias for poweroff (#3406) 2016-06-06 17:06:20 +02:00
Lennart Poettering b43d75c378 importd: drop dkr support
The current code is not compatible with current dkr protocols anyway,
and dkr has a different focus ("microservices") than nspawn anyway
("whole machine containers"), hence drop support for it, we cannot
reasonably keep this up to date, and it creates the impression we'd
actually care for the microservices usecase.
2015-12-10 16:54:41 +01:00
Evgeny Vereshchagin c2af810150 bash-completion: list valid signal names
this is a follow-up for commit 18540892d1
2015-11-24 16:05:42 +00:00
Lennart Poettering 1af1f2f92e shell-completion: add pseudo machine ".host" to shell completion 2015-10-08 15:14:27 +02:00
Lennart Poettering 56f3cb335a shell-completion: add "machinectl shell" to bash completion logic 2015-10-08 15:03:31 +02:00
Seth Jennings 4acd40613f shell-completion: bash: make list-transfers and cancel-transfer STANDALONE
list-transfers and cancel-transfers don't take machine arguments.
2015-08-18 13:22:42 -05:00
Seth Jennings 2977883de2 shell-completion: bash: add image transfer subcommands 2015-08-18 13:20:12 -05:00
Seth Jennings 4f8f4c310c shell-completion: use list-images rather than list
"machinectl list" only lists running machines while many of the MACHINES
commands use names of images; both running and non-running.

List machines from both "list" and "list-images" and use sort -u to
avoid duplicates.
2015-08-16 11:20:21 -05:00
Seth Jennings 6eb8bec62d shell-completion: update machinectl bash completion
Many new subcommands have been added since the bash completion was last
updated.  Bring it up to speed.
2015-08-16 11:19:36 -05:00
Thomas Hindoe Paaboel Andersen e56056e93d machinectl: add bash completion 2014-02-18 21:14:30 +01:00