mirror of
https://github.com/sagiegurari/duckscript
synced 2024-07-20 17:55:45 +00:00
move alias commands
This commit is contained in:
parent
4045d6addc
commit
9adee501e2
|
@ -1,4 +1,4 @@
|
|||
use crate::sdk::std::alias::ALIAS_STATE_KEY;
|
||||
use crate::sdk::std::lib::alias::ALIAS_STATE_KEY;
|
||||
use crate::utils::state::get_sub_state;
|
||||
use crate::utils::{eval, pckg};
|
||||
use duckscript::types::command::{Command, CommandResult, Commands};
|
|
@ -1,4 +1,4 @@
|
|||
use crate::sdk::std::alias::ALIAS_STATE_KEY;
|
||||
use crate::sdk::std::lib::alias::ALIAS_STATE_KEY;
|
||||
use crate::utils::pckg;
|
||||
use crate::utils::state::get_sub_state;
|
||||
use duckscript::types::command::{Command, CommandResult, Commands};
|
|
@ -1,5 +1,5 @@
|
|||
use super::*;
|
||||
use crate::sdk::std::alias;
|
||||
use crate::sdk::std::lib::alias;
|
||||
use crate::test;
|
||||
use crate::test::{CommandValidation, SetCommand};
|
||||
|
15
duckscript_sdk/src/sdk/std/lib/mod.rs
Executable file
15
duckscript_sdk/src/sdk/std/lib/mod.rs
Executable file
|
@ -0,0 +1,15 @@
|
|||
mod alias;
|
||||
|
||||
use crate::utils::pckg;
|
||||
use duckscript::types::command::Commands;
|
||||
use duckscript::types::error::ScriptError;
|
||||
|
||||
static PACKAGE: &str = "lib";
|
||||
|
||||
pub(crate) fn load(commands: &mut Commands, parent: &str) -> Result<(), ScriptError> {
|
||||
let package = pckg::concat(parent, PACKAGE);
|
||||
|
||||
alias::load(commands, &package)?;
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
use super::*;
|
||||
use crate::sdk::std::alias;
|
||||
use crate::sdk::std::release;
|
||||
use crate::test;
|
||||
use crate::test::{CommandValidation, SetCommand};
|
||||
|
||||
|
@ -38,9 +38,9 @@ fn run_command_not_found() {
|
|||
#[test]
|
||||
fn run_command_found_with_docs() {
|
||||
test::run_script_and_validate(
|
||||
vec![create(""), alias::set::create("")],
|
||||
"out = man alias",
|
||||
CommandValidation::Contains("out".to_string(), "alias ".to_string()),
|
||||
vec![create(""), release::create("")],
|
||||
"out = man release",
|
||||
CommandValidation::Contains("out".to_string(), "release ".to_string()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
pub(crate) mod alias;
|
||||
pub(crate) mod collections;
|
||||
mod debug;
|
||||
mod echo;
|
||||
|
@ -7,6 +6,7 @@ mod eval;
|
|||
mod flowcontrol;
|
||||
mod fs;
|
||||
mod is_defined;
|
||||
mod lib;
|
||||
mod man;
|
||||
mod math;
|
||||
mod net;
|
||||
|
@ -37,12 +37,12 @@ pub(crate) fn load(commands: &mut Commands) -> Result<(), ScriptError> {
|
|||
commands.set(release::create(PACKAGE))?;
|
||||
commands.set(set::create(PACKAGE))?;
|
||||
|
||||
alias::load(commands, PACKAGE)?;
|
||||
collections::load(commands, PACKAGE)?;
|
||||
debug::load(commands, PACKAGE)?;
|
||||
env::load(commands, PACKAGE)?;
|
||||
flowcontrol::load(commands, PACKAGE)?;
|
||||
fs::load(commands, PACKAGE)?;
|
||||
lib::load(commands, PACKAGE)?;
|
||||
math::load(commands, PACKAGE)?;
|
||||
net::load(commands, PACKAGE)?;
|
||||
on_error::load(commands, PACKAGE)?;
|
||||
|
|
Loading…
Reference in a new issue