From 185ecf1f45e6bf2198fe9ca3bb7ad175f412a014 Mon Sep 17 00:00:00 2001 From: Lunaphied Date: Thu, 21 Mar 2024 21:48:34 -0600 Subject: Improve new CLI UX by supporting short `-E` flag for `--expr` Change-Id: I55881c846da8416a92a14deedfa5bbbf09a122fb --- src/libcmd/installables.cc | 1 + src/nix/eval.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index 973db62b0..b40632887 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -187,6 +187,7 @@ SourceExprCommand::SourceExprCommand() addFlag({ .longName = "expr", + .shortName = 'E', .description = "Interpret [*installables*](@docroot@/command-ref/new-cli/nix.md#installables) as attribute paths relative to the Nix expression *expr*.", .category = installablesCategory, .labels = {"expr"}, diff --git a/src/nix/eval.md b/src/nix/eval.md index 48d5aa597..d1daaf755 100644 --- a/src/nix/eval.md +++ b/src/nix/eval.md @@ -8,10 +8,10 @@ R""( # nix eval --expr '1 + 2' ``` -* Evaluate a Nix expression to JSON: +* Evaluate a Nix expression to JSON using the short-form expression flag: ```console - # nix eval --json --expr '{ x = 1; }' + # nix eval --json -E '{ x = 1; }' {"x":1} ``` -- cgit v1.2.3