diff options
author | Simon Glass <sjg@chromium.org> | 2023-10-01 19:13:06 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-11 15:43:54 -0400 |
commit | 33eb0b9eef3360396aa0f650f8e1e01baf6dc181 (patch) | |
tree | c92ca08093001fca4f2ec92257b1b3f2850e09b4 /cmd | |
parent | 0f97e944b2bb08b7e13210fc6bea75817aee3237 (diff) | |
download | u-boot-33eb0b9eef3360396aa0f650f8e1e01baf6dc181.zip u-boot-33eb0b9eef3360396aa0f650f8e1e01baf6dc181.tar.gz u-boot-33eb0b9eef3360396aa0f650f8e1e01baf6dc181.tar.bz2 |
cli: Add a command to show cmdline history
There is a function for this but it is never used. Showing the history is
a useful feature, so add a new 'history' command.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/Kconfig | 7 | ||||
-rw-r--r-- | cmd/Makefile | 1 | ||||
-rw-r--r-- | cmd/history.c | 23 |
3 files changed, 31 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 6470b13..5bc0a92 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -176,6 +176,13 @@ config CMD_FWU_METADATA help Command to read the metadata and dump it's contents +config CMD_HISTORY + bool "history" + depends on CMDLINE_EDITING + help + Show the command-line history, i.e. a list of commands that are in + the history buffer. + config CMD_LICENSE bool "license" select BUILD_BIN2C diff --git a/cmd/Makefile b/cmd/Makefile index 9bebf32..971f78a 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -91,6 +91,7 @@ obj-$(CONFIG_CMD_FUSE) += fuse.o obj-$(CONFIG_CMD_FWU_METADATA) += fwu_mdata.o obj-$(CONFIG_CMD_GETTIME) += gettime.o obj-$(CONFIG_CMD_GPIO) += gpio.o +obj-$(CONFIG_CMD_HISTORY) += history.o obj-$(CONFIG_CMD_HVC) += smccc.o obj-$(CONFIG_CMD_I2C) += i2c.o obj-$(CONFIG_CMD_IOTRACE) += iotrace.o diff --git a/cmd/history.c b/cmd/history.c new file mode 100644 index 0000000..b6bf467 --- /dev/null +++ b/cmd/history.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#include <common.h> +#include <command.h> +#include <cli.h> + +static int do_history(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + cread_print_hist_list(); + + return 0; +} + +U_BOOT_CMD( + history, CONFIG_SYS_MAXARGS, 1, do_history, + "print command history", + "" +); |