Skip to content

Commit

Permalink
improved the klist command with the paramete 'all'
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Oct 6, 2024
1 parent 01471e7 commit e387ed6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ Please follow the instructions provided by [OSM_Extract](https://github.com/ares
IceNav has a basic CLI accessible via Serial and optionally via Telnet if enabled. When you access the CLI and type `help`, you should see the following commands:
```bash
clear: clear shell
info: get device information
nmcli: network manager CLI.
klist: list of user preferences. ('all' param show all)
kset: set an user extra preference
nmcli: network manager CLI. Type nmcli help for more info
poweroff: perform a ESP32 deep sleep
reboot: perform a ESP32 reboot
scshot: screenshot to SD or sending a PC
settings: device settings
Expand Down
7 changes: 5 additions & 2 deletions lib/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ void wcli_scshot(char *args, Stream *response)
void wcli_klist(char *args, Stream *response) {
Pair<String, String> operands = wcli.parseCommand(args);
String opt = operands.first();
int key_count = PKEYS::KUSER+1;
if (opt.equals("all")) key_count = 0; // Only show the basic keys to configure
response->printf("\n%11s \t%s \t%s \r\n", "KEYNAME", "DEFINED", "VALUE");
response->printf("\n%11s \t%s \t%s \r\n", "=======", "=======", "=====");

for (int i = PKEYS::KUSER+1; i < PKEYS::KCOUNT; i++) {
for (int i = key_count; i < PKEYS::KCOUNT; i++) {
if (i == PKEYS::KUSER) continue;
String key = cfg.getKey((CONFKEYS)i);
bool isDefined = cfg.isKey(key);
String defined = isDefined ? "custom " : "default";
Expand Down Expand Up @@ -359,7 +362,7 @@ void initShell(){
wcli.add("waypoint", &wcli_waypoint, "\twaypoint utilities");
wcli.add("settings", &wcli_settings, "\tdevice settings");
wcli.add("webfile", &wcli_webfile, "\tenable/disable Web file server");
wcli.add("klist", &wcli_klist, "\t\tlist of user extra preferences");
wcli.add("klist", &wcli_klist, "\t\tlist of user preferences. ('all' param show all)");
wcli.add("kset", &wcli_kset, "\t\tset an user extra preference");
wcli.begin("IceNav");
}
Expand Down

0 comments on commit e387ed6

Please sign in to comment.