diff --git a/CHANGELOG.md b/CHANGELOG.md index 79af482..44d8f0e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ ## CHANGELOG -### v0.1.3 +### v0.1.4 (2020-01-03) * New **contains** command #28 * New **ends_with** command #27 * New **starts_with** command #26 * New **equals** command #25 * -### v0.1.2 (2020-01-03) +### v0.1.3 (2020-01-03) * New **ls** command #9 * New **cp** command #7 diff --git a/docs/api/duckscript_sdk/source-files.js b/docs/api/duckscript_sdk/source-files.js index ea6c193..41c9a4f 100644 --- a/docs/api/duckscript_sdk/source-files.js +++ b/docs/api/duckscript_sdk/source-files.js @@ -1,3 +1,3 @@ var N = null;var sourcesIndex = {}; -sourcesIndex["duckscriptsdk"] = {"name":"","dirs":[{"name":"sdk","dirs":[{"name":"internal","dirs":[{"name":"sdkdocs","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"std","dirs":[{"name":"alias","files":["mod.rs"]},{"name":"array","files":["mod.rs"]},{"name":"echo","files":["mod.rs"]},{"name":"env","dirs":[{"name":"cd","files":["mod.rs"]},{"name":"get","files":["mod.rs"]},{"name":"pwd","files":["mod.rs"]},{"name":"set","files":["mod.rs"]},{"name":"unset","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"eval","files":["mod.rs"]},{"name":"forin","files":["mod.rs"]},{"name":"fs","dirs":[{"name":"basename","files":["mod.rs"]},{"name":"canonical","files":["mod.rs"]},{"name":"cp","files":["mod.rs"]},{"name":"dirname","files":["mod.rs"]},{"name":"list","files":["mod.rs"]},{"name":"mkdir","files":["mod.rs"]},{"name":"mv","files":["mod.rs"]},{"name":"print","files":["mod.rs"]},{"name":"read","files":["mod.rs"]},{"name":"rm","files":["mod.rs"]},{"name":"rmdir","files":["mod.rs"]},{"name":"touch","files":["mod.rs"]},{"name":"write","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"function","files":["mod.rs"]},{"name":"goto","files":["mod.rs"]},{"name":"ifelse","files":["mod.rs"]},{"name":"man","files":["mod.rs"]},{"name":"math","dirs":[{"name":"calc","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"not","files":["mod.rs"]},{"name":"process","dirs":[{"name":"exec","files":["mod.rs"]},{"name":"exit","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"release","files":["mod.rs"]},{"name":"set","files":["mod.rs"]},{"name":"test","dirs":[{"name":"assert","files":["mod.rs"]},{"name":"assert_eq","files":["mod.rs"]},{"name":"assert_fail","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"thread","dirs":[{"name":"sleep","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"unalias","files":["mod.rs"]}],"files":["mod.rs"]}],"files":["mod.rs"]},{"name":"utils","files":["condition.rs","eval.rs","flags.rs","instruction_query.rs","io.rs","mod.rs","pckg.rs","state.rs"]}],"files":["lib.rs"]}; +sourcesIndex["duckscriptsdk"] = {"name":"","dirs":[{"name":"sdk","dirs":[{"name":"internal","dirs":[{"name":"sdkdocs","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"std","dirs":[{"name":"alias","files":["mod.rs"]},{"name":"array","files":["mod.rs"]},{"name":"echo","files":["mod.rs"]},{"name":"env","dirs":[{"name":"cd","files":["mod.rs"]},{"name":"get","files":["mod.rs"]},{"name":"pwd","files":["mod.rs"]},{"name":"set","files":["mod.rs"]},{"name":"unset","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"eval","files":["mod.rs"]},{"name":"forin","files":["mod.rs"]},{"name":"fs","dirs":[{"name":"basename","files":["mod.rs"]},{"name":"canonical","files":["mod.rs"]},{"name":"cp","files":["mod.rs"]},{"name":"dirname","files":["mod.rs"]},{"name":"list","files":["mod.rs"]},{"name":"mkdir","files":["mod.rs"]},{"name":"mv","files":["mod.rs"]},{"name":"print","files":["mod.rs"]},{"name":"read","files":["mod.rs"]},{"name":"rm","files":["mod.rs"]},{"name":"rmdir","files":["mod.rs"]},{"name":"touch","files":["mod.rs"]},{"name":"write","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"function","files":["mod.rs"]},{"name":"goto","files":["mod.rs"]},{"name":"ifelse","files":["mod.rs"]},{"name":"man","files":["mod.rs"]},{"name":"math","dirs":[{"name":"calc","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"not","files":["mod.rs"]},{"name":"process","dirs":[{"name":"exec","files":["mod.rs"]},{"name":"exit","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"release","files":["mod.rs"]},{"name":"set","files":["mod.rs"]},{"name":"string","dirs":[{"name":"contains","files":["mod.rs"]},{"name":"ends_with","files":["mod.rs"]},{"name":"equals","files":["mod.rs"]},{"name":"starts_with","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"test","dirs":[{"name":"assert","files":["mod.rs"]},{"name":"assert_eq","files":["mod.rs"]},{"name":"assert_fail","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"thread","dirs":[{"name":"sleep","files":["mod.rs"]}],"files":["mod.rs"]},{"name":"unalias","files":["mod.rs"]}],"files":["mod.rs"]}],"files":["mod.rs"]},{"name":"utils","files":["condition.rs","eval.rs","flags.rs","instruction_query.rs","io.rs","mod.rs","pckg.rs","state.rs"]}],"files":["lib.rs"]}; createSourceSidebar(); diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/mod.rs.html index afbe2b6..74d1205 100644 --- a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/mod.rs.html +++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/mod.rs.html @@ -47,6 +47,8 @@ 47 48 49 +50 +51
 pub(crate) mod alias;
 mod array;
@@ -64,6 +66,7 @@
 mod process;
 mod release;
 mod set;
+mod string;
 mod test;
 mod thread;
 mod unalias;
@@ -92,6 +95,7 @@
     ifelse::load(commands, PACKAGE)?;
     math::load(commands, PACKAGE)?;
     process::load(commands, PACKAGE)?;
+    string::load(commands, PACKAGE)?;
     test::load(commands, PACKAGE)?;
     thread::load(commands, PACKAGE)?;
 
diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/contains/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/contains/mod.rs.html
new file mode 100644
index 0000000..48911e1
--- /dev/null
+++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/contains/mod.rs.html
@@ -0,0 +1,83 @@
+mod.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+
+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, "Contains")
+    }
+
+    fn aliases(&self) -> Vec<String> {
+        vec!["contains".to_string()]
+    }
+
+    fn help(&self) -> String {
+        include_str!("help.md").to_string()
+    }
+
+    fn run(&self, arguments: Vec<String>) -> CommandResult {
+        if arguments.len() < 2 {
+            CommandResult::Error("Two arguments are required.".to_string())
+        } else {
+            let result = arguments[0].contains(&arguments[1]);
+
+            CommandResult::Continue(Some(result.to_string()))
+        }
+    }
+}
+
+pub(crate) fn create(package: &str) -> Box<dyn Command> {
+    Box::new(CommandImpl {
+        package: package.to_string(),
+    })
+}
+
+
\ No newline at end of file diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/ends_with/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/ends_with/mod.rs.html new file mode 100644 index 0000000..f9fcc3a --- /dev/null +++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/ends_with/mod.rs.html @@ -0,0 +1,83 @@ +mod.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+
+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, "EndsWith")
+    }
+
+    fn aliases(&self) -> Vec<String> {
+        vec!["ends_with".to_string()]
+    }
+
+    fn help(&self) -> String {
+        include_str!("help.md").to_string()
+    }
+
+    fn run(&self, arguments: Vec<String>) -> CommandResult {
+        if arguments.len() < 2 {
+            CommandResult::Error("Two arguments are required.".to_string())
+        } else {
+            let result = arguments[0].ends_with(&arguments[1]);
+
+            CommandResult::Continue(Some(result.to_string()))
+        }
+    }
+}
+
+pub(crate) fn create(package: &str) -> Box<dyn Command> {
+    Box::new(CommandImpl {
+        package: package.to_string(),
+    })
+}
+
+
\ No newline at end of file diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/equals/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/equals/mod.rs.html new file mode 100644 index 0000000..d51cab5 --- /dev/null +++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/equals/mod.rs.html @@ -0,0 +1,83 @@ +mod.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+
+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, "Equals")
+    }
+
+    fn aliases(&self) -> Vec<String> {
+        vec!["equals".to_string(), "eq".to_string()]
+    }
+
+    fn help(&self) -> String {
+        include_str!("help.md").to_string()
+    }
+
+    fn run(&self, arguments: Vec<String>) -> CommandResult {
+        if arguments.len() < 2 {
+            CommandResult::Error("Two arguments are required.".to_string())
+        } else {
+            let result = arguments[0] == arguments[1];
+
+            CommandResult::Continue(Some(result.to_string()))
+        }
+    }
+}
+
+pub(crate) fn create(package: &str) -> Box<dyn Command> {
+    Box::new(CommandImpl {
+        package: package.to_string(),
+    })
+}
+
+
\ No newline at end of file diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/mod.rs.html new file mode 100644 index 0000000..0d977b3 --- /dev/null +++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/mod.rs.html @@ -0,0 +1,45 @@ +mod.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+
+mod contains;
+mod ends_with;
+mod equals;
+mod starts_with;
+
+use crate::utils::pckg;
+use duckscript::types::command::Commands;
+use duckscript::types::error::ScriptError;
+
+static PACKAGE: &str = "string";
+
+pub(crate) fn load(commands: &mut Commands, parent: &str) -> Result<(), ScriptError> {
+    let package = pckg::concat(parent, PACKAGE);
+
+    commands.set(contains::create(&package))?;
+    commands.set(ends_with::create(&package))?;
+    commands.set(equals::create(&package))?;
+    commands.set(starts_with::create(&package))?;
+
+    Ok(())
+}
+
+
\ No newline at end of file diff --git a/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/starts_with/mod.rs.html b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/starts_with/mod.rs.html new file mode 100644 index 0000000..2330e20 --- /dev/null +++ b/docs/api/duckscript_sdk/src/duckscriptsdk/sdk/std/string/starts_with/mod.rs.html @@ -0,0 +1,83 @@ +mod.rs.html -- source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+
+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, "StartsWith")
+    }
+
+    fn aliases(&self) -> Vec<String> {
+        vec!["starts_with".to_string()]
+    }
+
+    fn help(&self) -> String {
+        include_str!("help.md").to_string()
+    }
+
+    fn run(&self, arguments: Vec<String>) -> CommandResult {
+        if arguments.len() < 2 {
+            CommandResult::Error("Two arguments are required.".to_string())
+        } else {
+            let result = arguments[0].starts_with(&arguments[1]);
+
+            CommandResult::Continue(Some(result.to_string()))
+        }
+    }
+}
+
+pub(crate) fn create(package: &str) -> Box<dyn Command> {
+    Box::new(CommandImpl {
+        package: package.to_string(),
+    })
+}
+
+
\ No newline at end of file diff --git a/duckscript_cli/Cargo.toml b/duckscript_cli/Cargo.toml index 3dd9f2e..9cfd248 100644 --- a/duckscript_cli/Cargo.toml +++ b/duckscript_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duckscript_cli" -version = "0.1.3" +version = "0.1.4" authors = ["Sagie Gur-Ari "] description = "The duckscript command line executable." license = "Apache-2.0" diff --git a/duckscript_sdk/Cargo.toml b/duckscript_sdk/Cargo.toml index f02c305..3c4ba5a 100644 --- a/duckscript_sdk/Cargo.toml +++ b/duckscript_sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duckscriptsdk" -version = "0.1.3" +version = "0.1.4" authors = ["Sagie Gur-Ari "] description = "The duckscript SDK." license = "Apache-2.0"