diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d7d42c..b848afe 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
### v0.1.5
+* New trim_start command #29
+* New trim_end command #30
* New trim command
* New is_empty command
* New is_defined command
diff --git a/docs/sdk.md b/docs/sdk.md
index 91b8be9..933469d 100644
--- a/docs/sdk.md
+++ b/docs/sdk.md
@@ -41,6 +41,8 @@
* [sdk::string::IsEmpty (is_empty)](#sdk__string__IsEmpty)
* [sdk::string::StartsWith (starts_with)](#sdk__string__StartsWith)
* [sdk::string::Trim (trim)](#sdk__string__Trim)
+* [sdk::string::TrimEnd (trim_end)](#sdk__string__TrimEnd)
+* [sdk::string::TrimStart (trim_start)](#sdk__string__TrimStart)
* [sdk::test::Assert (assert)](#sdk__test__Assert)
* [sdk::test::AssertEquals (assert_eq)](#sdk__test__AssertEquals)
* [sdk::test::AssertFail (assert_fail)](#sdk__test__AssertFail)
@@ -1509,6 +1511,60 @@ trimmed = trim " some text "
#### Aliases:
trim
+
+## sdk::string::TrimEnd
+```sh
+var = trim_end value
+```
+
+Returns the provided value with trailing whitespace removed.
+
+#### Parameters
+
+The value to trim.
+
+#### Return Value
+
+The trimmed value. If no input provided, this command will return none.
+
+#### Examples
+
+```sh
+# trimmed will now hold " some text"
+trimmed = trim_end " some text "
+```
+
+
+#### Aliases:
+trim_end
+
+
+## sdk::string::TrimStart
+```sh
+var = trim_start value
+```
+
+Returns the provided value with leading whitespace removed.
+
+#### Parameters
+
+The value to trim.
+
+#### Return Value
+
+The trimmed value. If no input provided, this command will return none.
+
+#### Examples
+
+```sh
+# trimmed will now hold "some text "
+trimmed = trim_start " some text "
+```
+
+
+#### Aliases:
+trim_start
+
## sdk::test::Assert
```sh
diff --git a/duckscript_sdk/src/sdk/std/string/mod.rs b/duckscript_sdk/src/sdk/std/string/mod.rs
index 315457d..e8b2ace 100755
--- a/duckscript_sdk/src/sdk/std/string/mod.rs
+++ b/duckscript_sdk/src/sdk/std/string/mod.rs
@@ -4,6 +4,8 @@ mod equals;
mod is_empty;
mod starts_with;
mod trim;
+mod trim_end;
+mod trim_start;
use crate::utils::pckg;
use duckscript::types::command::Commands;
@@ -20,6 +22,8 @@ pub(crate) fn load(commands: &mut Commands, parent: &str) -> Result<(), ScriptEr
commands.set(is_empty::create(&package))?;
commands.set(starts_with::create(&package))?;
commands.set(trim::create(&package))?;
+ commands.set(trim_start::create(&package))?;
+ commands.set(trim_end::create(&package))?;
Ok(())
}
diff --git a/duckscript_sdk/src/sdk/std/string/trim_end/help.md b/duckscript_sdk/src/sdk/std/string/trim_end/help.md
new file mode 100644
index 0000000..35906c6
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_end/help.md
@@ -0,0 +1,20 @@
+```sh
+var = trim_end value
+```
+
+Returns the provided value with trailing whitespace removed.
+
+#### Parameters
+
+The value to trim.
+
+#### Return Value
+
+The trimmed value. If no input provided, this command will return none.
+
+#### Examples
+
+```sh
+# trimmed will now hold " some text"
+trimmed = trim_end " some text "
+```
diff --git a/duckscript_sdk/src/sdk/std/string/trim_end/mod.rs b/duckscript_sdk/src/sdk/std/string/trim_end/mod.rs
new file mode 100755
index 0000000..055e288
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_end/mod.rs
@@ -0,0 +1,39 @@
+use crate::utils::pckg;
+use duckscript::types::command::{Command, CommandResult};
+
+#[cfg(test)]
+#[path = "./mod_test.rs"]
+mod mod_test;
+
+struct CommandImpl {
+ package: String,
+}
+
+impl Command for CommandImpl {
+ fn name(&self) -> String {
+ pckg::concat(&self.package, "TrimEnd")
+ }
+
+ fn aliases(&self) -> Vec {
+ vec!["trim_end".to_string()]
+ }
+
+ fn help(&self) -> String {
+ include_str!("help.md").to_string()
+ }
+
+ fn run(&self, arguments: Vec) -> CommandResult {
+ if arguments.is_empty() {
+ CommandResult::Continue(None)
+ } else {
+ let result = arguments[0].trim_end();
+ CommandResult::Continue(Some(result.to_string()))
+ }
+ }
+}
+
+pub(crate) fn create(package: &str) -> Box {
+ Box::new(CommandImpl {
+ package: package.to_string(),
+ })
+}
diff --git a/duckscript_sdk/src/sdk/std/string/trim_end/mod_test.rs b/duckscript_sdk/src/sdk/std/string/trim_end/mod_test.rs
new file mode 100644
index 0000000..6f34842
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_end/mod_test.rs
@@ -0,0 +1,22 @@
+use super::*;
+use crate::test;
+use crate::test::CommandValidation;
+
+#[test]
+fn common_functions() {
+ test::test_common_command_functions(create(""));
+}
+
+#[test]
+fn run_no_args() {
+ test::run_script_and_validate(vec![create("")], "out = trim_end", CommandValidation::None);
+}
+
+#[test]
+fn run_with_spaces() {
+ test::run_script_and_validate(
+ vec![create("")],
+ r#"out = trim_end " some text " "#,
+ CommandValidation::Match("out".to_string(), " some text".to_string()),
+ );
+}
diff --git a/duckscript_sdk/src/sdk/std/string/trim_start/help.md b/duckscript_sdk/src/sdk/std/string/trim_start/help.md
new file mode 100644
index 0000000..a080acd
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_start/help.md
@@ -0,0 +1,20 @@
+```sh
+var = trim_start value
+```
+
+Returns the provided value with leading whitespace removed.
+
+#### Parameters
+
+The value to trim.
+
+#### Return Value
+
+The trimmed value. If no input provided, this command will return none.
+
+#### Examples
+
+```sh
+# trimmed will now hold "some text "
+trimmed = trim_start " some text "
+```
diff --git a/duckscript_sdk/src/sdk/std/string/trim_start/mod.rs b/duckscript_sdk/src/sdk/std/string/trim_start/mod.rs
new file mode 100755
index 0000000..60e660b
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_start/mod.rs
@@ -0,0 +1,39 @@
+use crate::utils::pckg;
+use duckscript::types::command::{Command, CommandResult};
+
+#[cfg(test)]
+#[path = "./mod_test.rs"]
+mod mod_test;
+
+struct CommandImpl {
+ package: String,
+}
+
+impl Command for CommandImpl {
+ fn name(&self) -> String {
+ pckg::concat(&self.package, "TrimStart")
+ }
+
+ fn aliases(&self) -> Vec {
+ vec!["trim_start".to_string()]
+ }
+
+ fn help(&self) -> String {
+ include_str!("help.md").to_string()
+ }
+
+ fn run(&self, arguments: Vec) -> CommandResult {
+ if arguments.is_empty() {
+ CommandResult::Continue(None)
+ } else {
+ let result = arguments[0].trim_start();
+ CommandResult::Continue(Some(result.to_string()))
+ }
+ }
+}
+
+pub(crate) fn create(package: &str) -> Box {
+ Box::new(CommandImpl {
+ package: package.to_string(),
+ })
+}
diff --git a/duckscript_sdk/src/sdk/std/string/trim_start/mod_test.rs b/duckscript_sdk/src/sdk/std/string/trim_start/mod_test.rs
new file mode 100644
index 0000000..5f25b0c
--- /dev/null
+++ b/duckscript_sdk/src/sdk/std/string/trim_start/mod_test.rs
@@ -0,0 +1,26 @@
+use super::*;
+use crate::test;
+use crate::test::CommandValidation;
+
+#[test]
+fn common_functions() {
+ test::test_common_command_functions(create(""));
+}
+
+#[test]
+fn run_no_args() {
+ test::run_script_and_validate(
+ vec![create("")],
+ "out = trim_start",
+ CommandValidation::None,
+ );
+}
+
+#[test]
+fn run_with_spaces() {
+ test::run_script_and_validate(
+ vec![create("")],
+ r#"out = trim_start " some text " "#,
+ CommandValidation::Match("out".to_string(), "some text ".to_string()),
+ );
+}