[Nickle] nickle: Branch 'master' - 2 commits
Keith Packard
keithp at keithp.com
Tue Dec 24 10:58:33 PST 2024
command.5c | 13 ++++++++++++-
nickle.1.in | 5 ++++-
test-nickle | 5 +++++
3 files changed, 21 insertions(+), 2 deletions(-)
New commits:
commit 01f77fec4062e365295c5eafd656a220d58b3b43
Author: Keith Packard <keithp at keithp.com>
Date: Tue Dec 24 10:57:38 2024 -0800
Add test-nickle script
This runs nickle before installation, including the startup scripts
and library files.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/test-nickle b/test-nickle
new file mode 100755
index 0000000..bf77de9
--- /dev/null
+++ b/test-nickle
@@ -0,0 +1,5 @@
+#!/bin/sh
+DIR=`dirname $0`
+export NICKLESTART="$DIR"/builtin.5c
+export NICKLEPATH="$DIR"
+"$DIR"/build/nickle "$@"
commit 904cebfea7787992791a9be5a4d96a0cba6c9a97
Author: Keith Packard <keithp at keithp.com>
Date: Tue Dec 24 10:56:21 2024 -0800
Add --version command line option
Make it easier to find out the currently installed nickle version
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/command.5c b/command.5c
index 25551df..2580ba1 100644
--- a/command.5c
+++ b/command.5c
@@ -303,6 +303,8 @@ extend namespace Command {
save_lexable((lexable.expr)arg);
lex_stdin = false;
}
+
+ bool show_version = false;
ParseArgs::argdesc argd = {
.args = {
@@ -320,7 +322,11 @@ extend namespace Command {
.abbr = 'e',
.name = "expr",
.expr_name = "expression",
- .desc = "Expression to evaluate."}
+ .desc = "Expression to evaluate."},
+ { .var = { .arg_flag = &show_version },
+ .abbr = 'V',
+ .name = "version",
+ .desc = "Print the Nickle version and exit"},
},
.posn_args = {
{ .var = { .arg_lambda = save_script},
@@ -334,6 +340,11 @@ extend namespace Command {
/* actually parse the arguments */
ParseArgs::parseargs(&argd, &argv);
+ if (show_version) {
+ printf("Nickle %s\n", version);
+ exit(0);
+ }
+
/* Reset argv to hold remaining arguments */
if (lex_stdin && is_uninit(&user_argind)) {
string[0] rest = {};
diff --git a/nickle.1.in b/nickle.1.in
index 4871ac2..9f7d7d0 100644
--- a/nickle.1.in
+++ b/nickle.1.in
@@ -2,7 +2,7 @@
.SH NAME
nickle \- a desk calculator language
.SH SYNOPSIS
-nickle [--help|--usage] [-f file] [-l library] [-e expr] [ script ] [--] [arg ...]
+nickle [--help|--usage] [-f file] [-l library] [-e expr] [-V] [ script ] [--] [arg ...]
.SH DESCRIPTION
.PP
\fINickle\fP is a
@@ -48,6 +48,9 @@ Evaluate
.I expr
before beginning execution.
.TP
+.BI "-V,--version"
+Print the Nickle version and exit.
+.TP
.B "--"
Quit parsing arguments and pass the remainder, unevaluated, to
.IR argv .
More information about the Nickle
mailing list