Commit Graph

42 Commits

Author SHA1 Message Date
a-kenji
d70db5af79 pkgs/cli: Autocomplete buildhost 2025-10-21 22:40:37 +02:00
a-kenji
c42381d810 pkgs/cli: Fix dynamic shell completions
Fix dynamic shell completions by correcting parameter names

Dynamic completions for the CLI were not working because completion
functions used `_prefix` as the first parameter name instead of `prefix`.
This is incompatible with how `argcomplete` passes it's arguments.

Add regression test for the prefix parameter as well as some basic shell
completion testing.
2025-10-21 14:19:30 +00:00
Johannes Kirschbauer
8609538756 clan_lib: allow explicit readonly access to inventory attributes 2025-10-14 17:21:39 +02:00
Jörg Thalheim
758eacd27e add apply "machine" as an alias to clan machines create
I was a bit confused that I was able to list templates but not
apply them. Turns out that "apply" only supported disk templates
2025-08-27 13:39:39 +00:00
Jörg Thalheim
d5b09f18ed RET504: fix 2025-08-26 15:55:23 +02:00
Jörg Thalheim
8f8426de52 PGH003: fix 2025-08-26 11:36:38 +02:00
Jörg Thalheim
31cbb7dc00 PLC0415: fix 2025-08-26 11:07:57 +02:00
Mic92
05665b1c7e Merge pull request 'ruff-3-arg-fixes' (#4934) from ruff-3-arg-fixes into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4934
2025-08-25 12:54:04 +00:00
Jörg Thalheim
04457b1272 ARG001: fix 2025-08-25 14:46:12 +02:00
Jörg Thalheim
332d10e306 s110: address 2025-08-25 14:07:59 +02:00
Jörg Thalheim
ea2d6aab65 ruff: apply automatic fixes 2025-08-25 11:34:41 +02:00
a-kenji
cacd853374 pkgs/cli: Support the flake argument for clan shell completions 2025-07-22 19:06:42 +02:00
a-kenji
cd8a1d9a32 pkgs/cli: Autocomplete various vars subcommands
Add autocomplete for `vars` for the following subcommands:

```
clan vars get [machine] [var_id]
clan vars set [machine] [var_id]
```
2025-07-22 18:03:55 +02:00
a-kenji
fb52b955cc pkgs/cli: Add completions to clan flakes create --template [TEMPLATE]
Add completions to `clan flakes create --template [TEMPLATE]`
2025-07-22 13:01:45 +02:00
a-kenji
c40fca6261 pkgs/clan(templates): Add shell completions 2025-07-15 14:46:04 +02:00
Johannes Kirschbauer
a98b2fb60c Chore(complete_machines): simplify by using inventoryStore 2025-06-10 19:15:07 +02:00
Johannes Kirschbauer
8de654f381 Refactor(autocompletions): use inventoryStore 2025-06-10 17:02:16 +02:00
lassulus
ed89352ea1 clan-cli: clan_cli.dirs -> clan_lib.dirs 2025-05-20 12:08:30 +02:00
lassulus
9a0c6f55bd clan-cli: clan_cli.cmd -> clan_lib.cmd 2025-05-19 19:07:24 +02:00
lassulus
cb74273da4 clan-cli: move clan_cli.nix to clan_lib.nix 2025-05-19 18:40:36 +02:00
Johannes Kirschbauer
8ddf0e50d3 Fix: dynamically import clan_cli in flake methods
This is a temporary workaround to solve cyclic imports all these modules should be moved to clan_lib
soon afterwards
2025-05-16 17:02:58 +02:00
Johannes Kirschbauer
9b96f87160 Chore(clan/clan_uri): Remove ClanURI class from clan_cli 2025-04-23 16:53:11 +02:00
Louis Opter
cd248b69db clan-cli: machines delete: delete the machine's vars and secrets
When a machine is deleted with `clan machines delete`, remove its
vars and legacy secrets, and update any secrets that reference the
machine's key.

This command is a superset of `clan secrets machine delete`, and I am
wondering if we could remove the `clan secrets machine` subcommand,
unless there is an use case for having a machine defined without its
key, and any secrets/vars?

Note:

- This deletes the `ListSecretsOptions` dataclass, as it did not seem to
  bring any value, especially since `list_secrets` was receiving its
  individual members instead of the whole dataclass. We can always bring
  it back if complexity grows to demand it.
2025-03-19 10:53:38 +00:00
Jörg Thalheim
527154070c use pathlib.iterdir() everywhere 2025-03-18 15:34:06 +01:00
lassulus
2a8f40e91a clan_cli machines: use Flake instead of FlakeId 2025-02-07 06:26:09 +01:00
Michael Hoang
60c2ca726a clan-cli: don't list non-Clan NixOS configurations 2024-12-17 15:11:38 +11:00
a-kenji
43bc09eb2e pkgs/cli: Add dynamic completer for tags
Add a dynamic completer for `tags`.

Queries tag information from:
- the keys of the computed/static tags (inventory tags)
- the services tags
- the machines tags
2024-11-11 13:48:00 +01:00
a-kenji
3ca6c4afac pkgs/cli: Add dynamic completer for target-host 2024-11-10 19:12:01 +01:00
Jörg Thalheim
483d8ce521 add SIM lint 2024-09-02 16:39:30 +02:00
Jörg Thalheim
2f1dac6962 make machine class now a dataclass 2024-07-03 12:34:43 +02:00
a-kenji
69e826fc17 cli: add command to list state
Add a subcommand to list configured state for a specific machine.

Example:
```
$ clan state list [MACHINE]
```
2024-06-25 09:34:31 +00:00
DavHau
4db2e8303f refactor: rename clanCore -> clan.core 2024-06-18 18:32:40 +07:00
a-kenji
cfd809581d clan: fix backup provider completions 2024-06-07 19:16:13 +00:00
a-kenji
0c09fcbbda clan: improve machine completions
In recent nix versions the `nix flake show` command busts the eval
cache, which made the function that used to be faster, slower.

On benchmarks the completion was around 180-200ms.
2024-06-05 13:32:23 +02:00
a-kenji
ece426f8b0 clan: fix backup description 2024-06-05 11:35:04 +02:00
a-kenji
99008e1e3a clan: add dynamic completion function for backup providers 2024-06-05 09:23:02 +00:00
a-kenji
37b620257f clan: add dynamic completions for secret groups 2024-06-04 13:30:38 +02:00
a-kenji
43d2644a99 clan: add completion function for clan users 2024-06-04 13:30:11 +02:00
a-kenji
cc401675fe clan: add dyncamic completions for secrets 2024-06-03 21:47:14 +02:00
a-kenji
a15286c709 clan: add dynamic completions for fact generation services 2024-05-31 15:21:07 +02:00
a-kenji
af0f628f35 clan: add completion timeout as static 2024-05-31 13:06:46 +02:00
a-kenji
32a20caad4 clan: add dynamic completions
Add dynamic completion scaffolding to the clan `cli`.
Also add a dynamic completion mechanism for machines for commands that
have machines as their sole argument.

More intricate dynamic completions will be implemented in follow up
PR's.
2024-05-31 12:55:41 +02:00