diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c873161..58f25ae 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,6 +20,7 @@ jobs: uses: rust-build/rust-build.action@v1.4.5 with: RUSTTARGET: x86_64-unknown-linux-musl + EXTRA_FILES: "README.md LICENSE" UPLOAD_MODE: none - name: Compile Windows - X86_64 @@ -27,6 +28,7 @@ jobs: uses: rust-build/rust-build.action@v1.4.5 with: RUSTTARGET: x86_64-pc-windows-gnu + EXTRA_FILES: "README.md LICENSE" UPLOAD_MODE: none # Broken: https://github.com/rust-build/rust-build.action/issues/88 @@ -35,6 +37,7 @@ jobs: # uses: rust-build/rust-build.action@v1.4.5 # with: # RUSTTARGET: x86_64-apple-darwin +# EXTRA_FILES: "README.md LICENSE" # UPLOAD_MODE: none - name: Upload artifact diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e88a32b --- /dev/null +++ b/readme.md @@ -0,0 +1,22 @@ +Rask +--- + +--- + +**R**unning T**ask**s - The universal way of running tasks. + + +```shell +Usage: rask + +Commands: + run + list + init + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help + -V, --version Print version + +``` \ No newline at end of file diff --git a/src/commands/init.rs b/src/commands/init.rs index 4067e9c..7b4cd4e 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -3,16 +3,16 @@ use crate::utils::file::{ConfigFile, parse_path_string, write_config_file}; #[derive(Args, Debug)] pub struct Arguments { - #[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")] - entry: String, - #[arg(help = "then name of the config file, defaults to the directory name", default_value = "")] - name: String, + #[arg(long, help = "The entry directory or rask.yaml file")] + entry: Option, + #[arg(help = "The rask config name, defaults to the directory name")] + name: Option, } pub fn execute(arguments: &Arguments) -> Result<(), String> { let Arguments { entry, name } = arguments; - let mut path = parse_path_string(entry)?; + let mut path = parse_path_string(&entry.clone().unwrap_or(".".to_string()))?; if path.is_dir() { path.push("rask.yaml") } @@ -21,8 +21,8 @@ pub fn execute(arguments: &Arguments) -> Result<(), String> { return Err(format!("Rask already initialised at {:?}", path)); } - let mut config_name = name.clone(); // Use clone to avoid modifying the original input - if config_name.is_empty() { + let config_name: String; + if name.is_none() { config_name = path.parent() .unwrap() .file_name() @@ -30,6 +30,8 @@ pub fn execute(arguments: &Arguments) -> Result<(), String> { .to_str() .unwrap() .to_string(); + } else { + config_name = name.clone().unwrap(); } let config_file: ConfigFile = ConfigFile { diff --git a/src/commands/list.rs b/src/commands/list.rs index 7d44717..cdc0c62 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -6,15 +6,15 @@ use crate::utils::file::ConfigFile; #[derive(Args, Debug)] pub struct Arguments { - #[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")] - entry: String, + #[arg(long, help = "The entry directory or rask.yaml file")] + entry: Option, } pub fn execute (arguments: &Arguments) -> Result<(), String> { let Arguments { entry } = arguments; // Resolve the entry path - let entry_config_path: PathBuf = config::resolve_config_path(entry)?; + let entry_config_path: PathBuf = config::resolve_config_path(&entry.clone().unwrap_or(".".to_string()))?; // Discover all config paths let config_file_paths: Vec = config::discover_config_paths(&entry_config_path)?; diff --git a/src/commands/run.rs b/src/commands/run.rs index 3b0185a..360fb6b 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -13,8 +13,8 @@ use crate::utils::file::ConfigFile; pub struct Arguments { #[arg(help = "Which task to run")] task_name: String, - #[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")] - entry: String, + #[arg(long, help = "The entry directory or rask.yaml file")] + entry: Option, } pub fn execute (arguments: &Arguments) -> Result<(), String> { @@ -24,7 +24,7 @@ pub fn execute (arguments: &Arguments) -> Result<(), String> { let start_time = Instant::now(); // Resolve the entry path - let entry_config_path: PathBuf = config::resolve_config_path(entry)?; + let entry_config_path: PathBuf = config::resolve_config_path(&entry.clone().unwrap_or(".".to_string()))?; // Discover all config paths let config_file_paths: Vec = config::discover_config_paths(&entry_config_path)?; diff --git a/src/main.rs b/src/main.rs index 67da40a..d653699 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,13 +9,16 @@ mod utils; #[derive(Subcommand, Debug)] enum Command { + /// Run specific tasks Run(run::Arguments), + /// List available tasks List(list::Arguments), + /// Initialize a new rask entry Init(init::Arguments), } #[derive(Parser, Debug)] -#[command(author, version, about, long_about = None, propagate_version = true)] +#[command(author, version, about = "Rask - The universal way of running tasks", long_about = None, propagate_version = true)] struct Arguments { #[command(subcommand)] command: Command