Added readme and license.
Rust Build / building (Windows - X86_64, x86_64-pc-windows-gnu) (push) Waiting to run Details
Rust Build / building (Linux - X86_64, x86_64-unknown-linux-musl) (push) Has been cancelled Details

Updated entry params
This commit is contained in:
Ian Wijma 2024-04-06 23:14:21 +11:00
parent 59b3017dcc
commit 57f694b08b
6 changed files with 44 additions and 14 deletions

View File

@ -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

22
readme.md Normal file
View File

@ -0,0 +1,22 @@
Rask
---
---
**R**unning T**ask**s - The universal way of running tasks.
```shell
Usage: rask <COMMAND>
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
```

View File

@ -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<String>,
#[arg(help = "The rask config name, defaults to the directory name")]
name: Option<String>,
}
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 {

View File

@ -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<String>,
}
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<PathBuf> = config::discover_config_paths(&entry_config_path)?;

View File

@ -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<String>,
}
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<PathBuf> = config::discover_config_paths(&entry_config_path)?;

View File

@ -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