1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00
Commit Graph

331 Commits

Author SHA1 Message Date
Ludwig Nussel
8ce171bf51 bootctl: add --random-seed=yes/no 2024-06-20 14:26:13 +09:00
hydrargyrum
5ebd945cda shell-completion: on zsh, systemd-cat is a precommand
_precommand lets zsh complete other commands and their arguments
e.g. it can complete grep with "systemd-cat gr" and complete grep options
with "systemd-cat grep -"
2024-05-09 13:25:32 +02:00
Arthur Zamarin
5db2bf1b30
shell-completion: add missing args to zsh resolvectl
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
2024-05-01 19:17:59 +03:00
Eisuke Kawashima
20927c0eec
improve zsh completion (#32098)
* fix error
* remove options that are no longer supported
* add missing options
* stop completion if an option `--help` or `--version` is supplied

[[[
zjs: a note for the reader:

zshcompsys(1) in the section about optspecs in _arguments says:

> Each of the forms above may be preceded by a list in parentheses of option names  and  argument  num‐
> bers.  If the given option is on the command line, the options and arguments indicated in parentheses
> will not be offered.  For example, ‘(-two -three 1)-one:...' completes the option ‘-one'; if this ap‐
> pears  on  the  command line, the options -two and -three and the first ordinary argument will not be
> completed after it.  ‘(-foo):...' specifies an ordinary argument completion; -foo will  not  be  com‐
> pleted if that argument is already present.
> 
> Other  items  may  appear in the list of excluded options to indicate various other items that should
> not be applied when the current specification is matched: a single star (\*) for  the  rest  arguments
> (i.e. a specification of the form ‘\*:...'); a colon (:) for all normal (non-option-) arguments; and a
> hyphen (-) for all options.  For example, if ‘(\*)' appears before an option and the option appears on
> the  command  line,  the  list  of remaining arguments (those shown in the above table beginning with
> ‘\*:') will not be completed.

The intended effect of the change is to remove irrelevant completion matches from the completion.

tl;dr: (- : ) prevents further completion
]]]
2024-04-15 10:58:48 +02:00
samuelvw01
3623a7ea83 Update _udevadm 2024-03-16 21:51:56 +09:00
Mike Yuan
cd804013a6 shell-completion: add systemd-cat --namespace=
Follow-up for 45bcab66a9

Addresses https://github.com/systemd/systemd/pull/31754#discussion_r1524715062
2024-03-14 13:07:19 +00:00
Štěpán Němec
c959e17823 man, shell-completion: fix a few typos/language issues 2024-02-27 16:57:33 +00:00
Štěpán Němec
da9e1f8322 zsh/_journalctl: complete -g, --case-sensitive, 'help' (pseudo-)facility 2024-02-27 13:50:15 +00:00
Ivan Shapovalov
9a887b1421 shell-completion/zsh: complete hidden images when word starts with "."
Show hidden images in the completion results, but only if the current
word starts with ".", such that
- `machinectl clone <Tab>` will only offer non-hidden images, but
- `machinectl clone .<Tab>` will offer both hidden and non-hidden images
2024-01-23 04:01:11 +01:00
Ivan Shapovalov
57d389c3fb shell-completion/zsh: improve and expand machinectl completion 2024-01-23 01:55:05 +01:00
Frantisek Sumsal
178c8c24ec shell-completion: provide completion for journalctl --namespace=
Resolves: #30381
2024-01-05 19:21:51 +01:00
Frantisek Sumsal
68f66a1713 journalctl: implement --list-namespaces
Apart from being useful on its own, this will be used in the following
commit for shell completions.
2024-01-05 19:21:51 +01:00
Daan De Meyer
dedb925eaf meson: Always build bootctl
bootctl is rather useful to have, even if on a system without UEFI,
as it has a number of verbs that are unrelated to UEFI (e.g kernel-identify),
and more importantly, it supports --root to operate on directory trees
(which could be intended to be deployed on UEFI) so let's make sure we
always build it.
2023-10-25 16:49:24 +02:00
Ronan Pigott
47f20650b7 zsh: busctl: fix flags parsing for properties
I'm not quite sure what the original intent of this line was, but it
doesn't work in the one call-site the "required" argument is actually
used. The "writable" flag was indexed as a scalar leaving only the
"e" to compare against.

Instead, let's just sort the parsed flags and compare the whole thing.
Also substitute "required" as a pattern, so that pattern based
comparisons may be supported.
2023-09-09 01:28:07 +01:00
Ronan Pigott
2cbda74862 zsh: reintroduce pattern argument to uncached verbs
The systemctl completion previously made use of PREFIX as a pattern
argument to list-unit-files and list-units. This had the problem of
erroneously filtering the results that were stored in the cache, and
erroneously filtering results that might have been requested according
to the users configuration (e.g. _correct completer, certain
matcher-lists or tag-orders, etc.).

Unfortunately, the runtime of list-unit-files increases when no pattern
argument is provided, and systemctl show, used to filter those units,
can become unacceptably slow when provided with too many units to
describe.

Let's re-introduce the pattern argument to list-unit-files and
list-units where necessary in order to alleviate these bottlenecks
without poisining the cache. A 'use-pattern' style is introduced that
may be used to disable this behavior if it is undesired. We can still
expect that certain completions, like `systemctl start <TAB>` will be
slow, like before. To fix this we will need systemd to learn a more
efficient way of filtering the units than parsing systemctl show.
2023-08-08 01:57:45 -07:00
Ronan Pigott
c8e2cd79c1 zsh: use sys_really_all_units for non-template names
The systemctl invocations used for these completions match the ones used
for the _sys_really_all_units parameter, so we should really just use
the cached parameter rather than recomputing the result.
2023-08-07 18:00:04 -07:00
Luca Boccassi
b0d3095fd6 Drop split-usr and unmerged-usr support
As previously announced, execute order 66:

https://lists.freedesktop.org/archives/systemd-devel/2022-September/048352.html

The meson options split-usr, rootlibdir and rootprefix become no-ops
that print a warning if they are set to anything other than the
default values. We can remove them in a future release.
2023-07-28 19:34:03 +01:00
Ronan Pigott
9ec0808370 zsh: use glob matching for template names
Template names can be learned from the filesystem, so there isn't a need
to parse the output of systemctl list-unit-files in this case. This
should accelerate the completion of some verbs like enable.
2023-07-19 15:07:39 -07:00
Ronan Pigott
ae6fb82cd9 zsh: remove unit property caching
The existing caching policy isn't very sensible for this cache. We could
write a different policy, but I don't think there is much value in
caching these values, as in my experience the command used to generate
them is quick.
2023-07-19 14:27:45 -07:00
Ronan Pigott
110ba0ccf9 zsh: update default caching policy for units
The existing caching policy was completely bogus.

In the first stanza, despite the comment, the pattern given would
consider the cache invalid if it was more than 1 hour old.

The second stanza was also incorrect, since the output of `systemctl
--all` is not unit file paths, but unit names. When they were being
tested against the cachefile mtime, the test would always fail becuase
of the nonexistant file (hopefully).

In fact it's not very useful to test if the unit files have newer mtime
in this case anyway, since we are only caching their names. Also,
`systemctl --all` is an unfortunately slow operation to be used in
testing for the cache validity — we want this operation to at least be
faster than rebuilding the cache.

I've rewritten this stanza with my best guess at its original intent. It
now checks against the mtime of the parent directories in the search
path, which should be updated and cause the cache to rebuild when we
add, remove, or rename any unit files.
2023-07-19 14:27:45 -07:00
Ronan Pigott
8a8caeccb2 zsh: stop forcing unit file cache rebuilds
Rebuilding whenever the cached parameter is not set forces each new
shell to rebuild the cache, which often defeates the purpose of caching
in the first place.
2023-07-17 16:38:25 -07:00
Ronan Pigott
087f777a1c zsh: default to system manager when not specified
This used to work correctly, before the change was reverted in
e09d0d46c2. In fact it is important to specify the manager explicity
in the completion because the argument is reused in the caching
policies. An empty argument here caused the completion to create
separate caches with and without the --system parameter. We can simplify
the given pattern a little here too.
2023-07-17 16:35:29 -07:00
Ronan Pigott
d0fc94a192 zsh: suppress aliases and shell functions when calling systemctl
This prevents any errors in case the user had aliased some arguments
following systemctl.
2023-07-17 16:20:03 -07:00
Ronan Pigott
3b4c6009c0 zsh: typo in systemctl completions 2023-07-17 16:08:58 -07:00
Christian Hesse
77d4986415 shell-completion/zsh/resolvectl: add show-cache
Make zsh shell-completion aware of show-cache.
2023-07-07 14:05:11 +02:00
Christian Hesse
6864f9b9e9 shell-completion/zsh/systemctl: add whoami
Make zsh shell-completion aware of whoami.
2023-07-07 14:02:41 +02:00
Christian Hesse
050d6d711a shell-completion/zsh/systemctl: add soft-reboot
Make zsh shell-completion aware of soft-reboot.
2023-07-07 13:57:03 +02:00
Cyril Roelandt
3c6fefd879 Fix zsh completion for "localectl set-locale"
When running:

    $ localectl set-locale LC_MESSAGES=<TAB>

One is prompted with a list of locale fields instead of the list of
valid locales. This is because by calling "compset -P1 '*='", we modify
the $PREFIX special parameter before testing whether it contains an
equal sign. Therefore

    if [[ -prefix 1 *\= ]]

is always false, and we always suggest a list of locale fields to the
user.

Fixes: #27955
2023-06-07 13:54:12 +01:00
Yu Watanabe
1bf3dd4153 udev: downgrade log level about style issues
And add --no-style switch that make style issues not critical.
2023-06-05 11:37:26 +09:00
Ronan Pigott
110789987d zsh: amend completion for networkctl edit 2023-05-22 12:14:04 +01:00
Dmitry V. Levin
9e36da1541 udevadm-verify: introduce --no-summary option
When udevadm verify is invoked by an analyzer tool like rpminspect
to verify individual udev rules files, the summary just clutters the
output, so provide an option to turn the summary off.
2023-05-21 23:20:30 +09:00
Marko Korhonen
2ad681f53c
shell completion: add timesync-status and show-timesync to zsh completion file (#27574)
Fixes #27560
2023-05-09 01:01:16 +09:00
Ronan Pigott
b3d12ac0da zsh: add service-log-{level,target} completions for systemctl 2023-05-08 01:08:36 +01:00
Ronan Pigott
8139407ec1 zsh: remove usage of PREFIX in _systemctl
The usage of PREFIX in this completion is mostly counter to the intended
usage of compsys in zsh. It is generally expected that completion code
provide the available completions and tags in that word position so that
compsys, with user configuration, can filter them to the appropriate set.

One egregious error caused by the usage of PREFIX here is the caching of
SYS_ALL_UNITS, which stored only the unit names prematurely filtered by
the completion prefix, affecting all future completions. For example,

  $ systemctl cat nonsense<TAB>

might find no matching units if nonsense* has no matches, but now

  $ systemctl cat <TAB>

will fail in all future completions even though every unit file
is a valid match, because the cached set has been erroneously filtered
by the last prefix.
2023-05-05 22:12:50 +01:00
Masatake YAMATO
a5efb0cc2b shell-completion: add --xml-interface option of busctl to the rules
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2023-04-11 11:47:56 +09:00
Yu Watanabe
c9501b03cd
Merge pull request #26641 from medhefgo/boot-elf2efi
boot: Drop gnu-efi / Add elf2efi.py
2023-03-11 17:15:01 +09:00
Dmitry V. Levin
0a7eda348c udevadm verify: introduce --root option
When udevadm verify is invoked without positional arguments and loads
all rules files from the system like the udev daemon does, this option
can be used to operate on files underneath the specified root path.
2023-03-10 17:10:41 +00:00
Jan Janssen
dfca5587cf tree-wide: Drop gnu-efi
This drops all mentions of gnu-efi and its manual build machinery. A
future commit will bring bootloader builds back. A new bootloader meson
option is now used to control whether to build sd-boot and its userspace
tooling.
2023-03-10 11:41:03 +01:00
Dmitry V. Levin
acdba85e0e udevadm: introduce new 'verify' command
We seem to have no tool to verify udev rule files.  There is a simple
udev rules syntax checker in the tree, test/rule-syntax-check.py, but
it is too simple to detect less trivial issues not detected by udev,
e.g. redundant comparisons (#26593) or labels without references.

Such a tool would be beneficial not only for maintaining udev rules
distributed along with udev, but also and even more so for maintaining
third party udev rules that are more likely to have issues with syntax
and semantic correctness.

Implement a udev rules syntax and semantics checker in the form of
'udevadm verify [OPTIONS] FILE...' command that is based on
udev_rules_parse_file() interface and would apply further checks
on top of it in subsequent commits.

Resolves: #26606
2023-03-08 18:55:40 +00:00
David Tardon
7336968488 shell-completion: add systemctl list-paths 2023-02-21 19:03:26 +01:00
Ludwig Nussel
8702496bfb bootctl: unlink and cleanup functions
The unlink command removes an entry from the ESP including
referenced files that are not referenced in other entries. That is
useful eg to have multiple entries that use the same kernel with
different options.

The cleanup command removes all files that are not referenced by any
entry.
2023-01-19 14:24:43 +01:00
joshuazivkovic
f21a6502d8 systemd-analyze: Add tab complete logic for plot 2023-01-18 14:33:08 +00:00
Yu Watanabe
93b0ec8bc5 shell-completion: systemctl: add --no-warn 2023-01-12 11:51:19 +09:00
Zbigniew Jędrzejewski-Szmek
9e7cc6f0d2 shell-completion/zsh: rename helper for clarity 2022-10-20 09:58:00 +02: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
0923b4253c tree-wide: replace "plural(s)" by "plurals"
(s) is just ugly with a vibe of DOS. In most cases just using the normal plural
form is more natural and gramatically correct.

There are some log_debug() statements left, and texts in foreign licenses or
headers. Those are not touched on purpose.
2022-10-17 15:10:53 +02:00
Daniel Braunwarth
893bcd3d07 shared/logs-show: add new --output= format "short-delta"
This new output formatting option is similar to "short-monotonic" but
also shows the time delta between two messages.

This fixes #24641.
2022-09-23 10:07:03 +02:00
Yu Watanabe
c4c9714464 shell-completion: drop unused $mode
Fixes #24473.
2022-08-28 08:11:26 +00: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
David Tardon
5edea3b77e shell-completion: add systemctl list-automounts 2022-07-25 13:37:20 +02:00