diff --git a/.buildnumber b/.buildnumber
index 3cacc0b9..ca7bf83a 100644
--- a/.buildnumber
+++ b/.buildnumber
@@ -1 +1 @@
-12
\ No newline at end of file
+13
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8dd06547..3db5e4b7 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
## CHANGELOG
-### v0.11.0
+### v0.11.0 (2024-10-04)
* Enhancement: Runtime - \[Breaking Change\] Renamed command args to context.
diff --git a/Cargo.lock b/Cargo.lock
index e8c78ec3..67af7e82 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -281,14 +281,14 @@ dependencies = [
[[package]]
name = "duckscript"
-version = "0.9.0"
+version = "0.10.0"
dependencies = [
"fsio",
]
[[package]]
name = "duckscript_cli"
-version = "0.10.0"
+version = "0.11.0"
dependencies = [
"duckscript",
"duckscriptsdk",
@@ -296,7 +296,7 @@ dependencies = [
[[package]]
name = "duckscriptsdk"
-version = "0.10.0"
+version = "0.11.0"
dependencies = [
"attohttpc",
"base64",
diff --git a/README.md b/README.md
index ee9a547a..b8e43057 100644
--- a/README.md
+++ b/README.md
@@ -410,7 +410,7 @@ Commands are structs that must implement the Command trait.
* They should return help documentation in markdown format in order to generate SDK documentation (must for PRs to duckscript official SDK).
* They must implement the **run** function which holds the command logic.
-The run function accepts the command arguments (args array contains actual values and not original variables) and returns the command result.
+The run function accepts the command invocation context (args array contains actual values and not original variables) and returns the command result.
The command result can be one of the following:
* Continue(Option) - Tells the runner to continue to the next command and optionally set the output variable the given value.
@@ -437,11 +437,11 @@ impl Command for SetCommand {
Box::new((*self).clone())
}
- fn run(&self, arguments: CommandArgs) -> CommandResult {
- let output = if arguments.args.is_empty() {
+ fn run(&self, context: CommandInvocationContext) -> CommandResult {
+ let output = if context.arguments.is_empty() {
None
} else {
- Some(arguments.args[0].clone())
+ Some(context.arguments[0].clone())
};
CommandResult::Continue(output)
@@ -468,11 +468,11 @@ impl Command for GetEnvCommand {
Box::new((*self).clone())
}
- fn run(&self, arguments: CommandArgs) -> CommandResult {
- if arguments.args.is_empty() {
+ fn run(&self, context: CommandInvocationContext) -> CommandResult {
+ if context.arguments.is_empty() {
CommandResult::Error("Missing environment variable name.".to_string())
} else {
- match env::var(&arguments.args[0]) {
+ match env::var(&context.arguments[0]) {
Ok(value) => CommandResult::Continue(Some(value)),
Err(_) => CommandResult::Continue(None),
}
@@ -485,13 +485,13 @@ You can look at more examples in the duckscript_sdk folder.
## Access The Context
-The duckscript runtime context is available in the CommandArgs struc.
+The duckscript runtime context is available in the CommandInvocationContext struc.
```rust
/// Run the instruction with access to the runtime context.
///
-/// The CommandArgs has the following members:
-/// * `args` - The command arguments array
+/// The CommandInvocationContext has the following members:
+/// * `arguments` - The command arguments array
/// * `state` - Internal state which is only used by commands to store/pull data
/// * `variables` - All script variables
/// * `output_variable` - The output variable name (if defined)
@@ -499,7 +499,7 @@ The duckscript runtime context is available in the CommandArgs struc.
/// * `commands` - The currently known commands
/// * `line` - The current instruction line number (global line number after including all scripts into one global script)
/// * `env` - The current runtime env with access to out/err writers, etc...
-fn run(&self, arguments: CommandArgs) -> CommandResult;
+fn run(&self, context: CommandInvocationContext) -> CommandResult;
```
With access to this context you can add/remove/switch commands in runtime, store/pull internal state, add/remove/change variables and so on...
diff --git a/docs/_includes/content.md b/docs/_includes/content.md
index bdd82e37..b75ec4ab 100755
--- a/docs/_includes/content.md
+++ b/docs/_includes/content.md
@@ -365,7 +365,7 @@ Commands are structs that must implement the Command trait.
* They should return help documentation in markdown format in order to generate SDK documentation (must for PRs to duckscript official SDK).
* They must implement the **run** function which holds the command logic.
-The run function accepts the command arguments (args array contains actual values and not original variables) and returns the command result.
+The run function accepts the command invocation context (args array contains actual values and not original variables) and returns the command result.
The command result can be one of the following:
* Continue(Option) - Tells the runner to continue to the next command and optionally set the output variable the given value.
@@ -392,11 +392,11 @@ impl Command for SetCommand {
Box::new((*self).clone())
}
- fn run(&self, arguments: CommandArgs) -> CommandResult {
- let output = if arguments.args.is_empty() {
+ fn run(&self, context: CommandInvocationContext) -> CommandResult {
+ let output = if context.arguments.is_empty() {
None
} else {
- Some(arguments.args[0].clone())
+ Some(context.arguments[0].clone())
};
CommandResult::Continue(output)
@@ -423,11 +423,11 @@ impl Command for GetEnvCommand {
Box::new((*self).clone())
}
- fn run(&self, arguments: CommandArgs) -> CommandResult {
- if arguments.args.is_empty() {
+ fn run(&self, context: CommandInvocationContext) -> CommandResult {
+ if context.arguments.is_empty() {
CommandResult::Error("Missing environment variable name.".to_string())
} else {
- match env::var(&arguments.args[0]) {
+ match env::var(&context.arguments[0]) {
Ok(value) => CommandResult::Continue(Some(value)),
Err(_) => CommandResult::Continue(None),
}
@@ -440,13 +440,13 @@ You can look at more examples in the duckscript_sdk folder.
## Access The Context
-The duckscript runtime context is available in the CommandArgs struc.
+The duckscript runtime context is available in the CommandInvocationContext struc.
```rust
/// Run the instruction with access to the runtime context.
///
-/// The CommandArgs has the following members:
-/// * `args` - The command arguments array
+/// The CommandInvocationContext has the following members:
+/// * `arguments` - The command arguments array
/// * `state` - Internal state which is only used by commands to store/pull data
/// * `variables` - All script variables
/// * `output_variable` - The output variable name (if defined)
@@ -454,7 +454,7 @@ The duckscript runtime context is available in the CommandArgs struc.
/// * `commands` - The currently known commands
/// * `line` - The current instruction line number (global line number after including all scripts into one global script)
/// * `env` - The current runtime env with access to out/err writers, etc...
-fn run(&self, arguments: CommandArgs) -> CommandResult;
+fn run(&self, context: CommandInvocationContext) -> CommandResult;
```
With access to this context you can add/remove/switch commands in runtime, store/pull internal state, add/remove/change variables and so on...
diff --git a/duckscript/Cargo.toml b/duckscript/Cargo.toml
index ee5332d9..d0db50ed 100644
--- a/duckscript/Cargo.toml
+++ b/duckscript/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "duckscript"
-version = "0.9.0"
+version = "0.10.0"
authors = ["Sagie Gur-Ari "]
description = "Simple, extendable and embeddable scripting language."
license = "Apache-2.0"
diff --git a/duckscript_cli/Cargo.toml b/duckscript_cli/Cargo.toml
index 80cb8aff..122fe60c 100644
--- a/duckscript_cli/Cargo.toml
+++ b/duckscript_cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "duckscript_cli"
-version = "0.10.0"
+version = "0.11.0"
authors = ["Sagie Gur-Ari "]
description = "The duckscript command line executable."
license = "Apache-2.0"
@@ -27,8 +27,8 @@ name = "duck"
path = "src/main.rs"
[dependencies]
-duckscript = { version = "^0.9.0", path = "../duckscript" }
-duckscriptsdk = { version = "^0.10.0", path = "../duckscript_sdk", default-features = false }
+duckscript = { version = "^0.10.0", path = "../duckscript" }
+duckscriptsdk = { version = "^0.11.0", path = "../duckscript_sdk", default-features = false }
[features]
tls-rustls = ["duckscriptsdk/tls-rustls"]
diff --git a/duckscript_sdk/Cargo.toml b/duckscript_sdk/Cargo.toml
index 829731d3..0322617a 100644
--- a/duckscript_sdk/Cargo.toml
+++ b/duckscript_sdk/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "duckscriptsdk"
-version = "0.10.0"
+version = "0.11.0"
authors = ["Sagie Gur-Ari "]
description = "The duckscript SDK."
license = "Apache-2.0"
@@ -29,7 +29,7 @@ attohttpc = { version = "^0.28", default-features = false, features = [
base64 = "^0.22"
cfg-if = "^1"
colored = "^2"
-duckscript = { version = "^0.9.0", path = "../duckscript" }
+duckscript = { version = "^0.10.0", path = "../duckscript" }
evalexpr = "^11"
fs_extra = "^1"
fsio = { version = "^0.4", features = ["temp-path"] }