All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] add "call" command
@ 2020-09-25 11:19 Rasmus Villemoes
  2020-09-25 11:19 ` [PATCH 1/3] cli_hush.c: refactor handle_dollar() to prepare for cmd_call Rasmus Villemoes
                   ` (5 more replies)
  0 siblings, 6 replies; 38+ messages in thread
From: Rasmus Villemoes @ 2020-09-25 11:19 UTC (permalink / raw)
  To: u-boot

This adds a way to call a "function" defined in the environment with
arguments. I.e., whereas

  run foo

requires one to set the (shell or environment) variables referenced
from foo beforehand, with this one can instead do

  call foo arg1 arg2 arg3

and use $1... up to $9 in the definition of foo. $# is set so foo can
make decisions based on that, and ${3:-default} works as expected.

As I write in patch 2, it should be possible to get rid of the "call"
and simply allow

  foo arg1 arg2 arg3

i.e. if the search for a command named foo fails, try an environment
variable by that name and do it as "call". But that change of
behaviour, I think, requires a separate opt-in config knob, and can be
done later if someone actually wants that.

Rasmus Villemoes (3):
  cli_hush.c: refactor handle_dollar() to prepare for cmd_call
  cli_hush.c: add "call" command
  ut: add small hush tests

 cmd/Kconfig                 |  8 ++++
 common/cli_hush.c           | 93 +++++++++++++++++++++++++++++++++----
 configs/sandbox64_defconfig |  1 +
 configs/sandbox_defconfig   |  1 +
 include/test/suites.h       |  1 +
 test/cmd/Makefile           |  1 +
 test/cmd/hush.c             | 90 +++++++++++++++++++++++++++++++++++
 test/cmd_ut.c               |  6 +++
 8 files changed, 191 insertions(+), 10 deletions(-)
 create mode 100644 test/cmd/hush.c

-- 
2.23.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2020-11-08 13:28 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 11:19 [PATCH 0/3] add "call" command Rasmus Villemoes
2020-09-25 11:19 ` [PATCH 1/3] cli_hush.c: refactor handle_dollar() to prepare for cmd_call Rasmus Villemoes
2020-09-25 13:02   ` Wolfgang Denk
2020-09-25 11:19 ` [PATCH 2/3] cli_hush.c: add "call" command Rasmus Villemoes
2020-09-25 13:18   ` Rasmus Villemoes
2020-09-26  8:37     ` Wolfgang Denk
2020-09-25 11:19 ` [PATCH 3/3] ut: add small hush tests Rasmus Villemoes
2020-09-25 11:52 ` [PATCH 0/3] add "call" command Heinrich Schuchardt
2020-09-25 12:36   ` Rasmus Villemoes
2020-09-25 13:09   ` Wolfgang Denk
2020-09-25 13:38     ` Rasmus Villemoes
2020-09-25 13:38     ` Heinrich Schuchardt
2020-09-25 13:51       ` Rasmus Villemoes
2020-09-26  8:55         ` Wolfgang Denk
2020-09-26  8:51       ` Wolfgang Denk
2020-09-26 10:39         ` Heinrich Schuchardt
2020-09-26 14:13           ` Wolfgang Denk
2020-09-25 12:59 ` Wolfgang Denk
2020-09-25 14:40   ` Simon Glass
2020-09-26 14:02     ` Wolfgang Denk
2020-09-29 17:45       ` Tom Rini
2020-09-30 11:46         ` Wolfgang Denk
2020-10-07  7:20 ` [PATCH v2 0/3] allow positional arguments with "run" Rasmus Villemoes
2020-10-07  7:20   ` [PATCH v2 1/3] cli_hush.c: refactor handle_dollar() to prepare for "run with arguments" Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-10-07  7:20   ` [PATCH v2 2/3] allow positional arguments with "run" command Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-10-12  7:06       ` Rasmus Villemoes
2020-10-15 15:05         ` Simon Glass
2020-10-15 22:06           ` Rasmus Villemoes
2020-10-19  7:31             ` Wolfgang Denk
2020-10-19  8:31               ` Rasmus Villemoes
2020-10-19  8:49                 ` Wolfgang Denk
2020-10-07  7:20   ` [PATCH v2 3/3] ut: add small hush tests Rasmus Villemoes
2020-10-12  3:34     ` Simon Glass
2020-11-05  7:25   ` [PATCH v2 0/3] allow positional arguments with "run" Rasmus Villemoes
2020-11-06 20:52     ` Tom Rini
2020-11-08 13:28       ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.