Commit graph

14 commits

Author SHA1 Message Date
Felix Fietkau
bd073e5cd9 cli: fix editor remove call validation
Skip type validation, fix passing values to remove

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-07-19 21:23:18 +02:00
Felix Fietkau
14d5a51822 cli: add json data type
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-07-10 10:48:19 +02:00
Felix Fietkau
6296c17026 cli: return the correct data type for enum attributes
Return entries from the value array instead of the provided string

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-05-31 16:23:47 +02:00
Felix Fietkau
71bec727c8 cli: fix dealing with enum types with object value lists
Convert to array before calling filter()

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-05-31 16:22:46 +02:00
Felix Fietkau
1735da8e4c cli: add explicit option for pretty printing command result data
No-op for now, but allows making output more machine readable

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-04-30 11:04:14 +02:00
Felix Fietkau
37c80e61ee cli: extend remove call to allow passing values directly
This simplifies script or API usage of this command to remove values directly
without having to calculate the index

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-04-11 10:41:12 +02:00
Felix Fietkau
a46a55b407 cli: fix showing empty lists
Display <none> as value instead of hiding the attribute name

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-13 11:23:03 +01:00
Felix Fietkau
ae31c0ddd7 cli: fix removing values when attribute has .get_object set
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-13 11:23:03 +01:00
Felix Fietkau
f6a9cce09a cli: fix spurious error when exiting the cli
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-09 10:52:07 +01:00
Felix Fietkau
7f0913d7b1 cli: improve error handling on editor select call
Use common error functions instead of explicit warn() calls

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-09 10:52:07 +01:00
Felix Fietkau
7953376400 cli: use model scope for hook calls
Make the scope consistent with other callbacks

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-28 17:36:01 +01:00
Felix Fietkau
bc078b833a cli: add support for create/destroy object editor with single type
Allows hooking create/destroy in a separate menu without having the user
specify a type argument.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-28 17:36:01 +01:00
Felix Fietkau
895b4e7caf cli: add support for partial completion with separator character
Useful for completing long lists of possible values with common prefix

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-28 17:36:01 +01:00
Felix Fietkau
248b66b44f cli: add OpenWrt CLI
This provides an easy to use modular CLI that can be used to interact with
OpenWrt services. It has full support for context sensitive tab completion
and help.
Extra modules can be provided by packages and can extend the existing node
structure in any place.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-13 19:00:30 +01:00