Added readme and license.
Updated entry params
This commit is contained in:
parent
59b3017dcc
commit
57f694b08b
|
@ -20,6 +20,7 @@ jobs:
|
||||||
uses: rust-build/rust-build.action@v1.4.5
|
uses: rust-build/rust-build.action@v1.4.5
|
||||||
with:
|
with:
|
||||||
RUSTTARGET: x86_64-unknown-linux-musl
|
RUSTTARGET: x86_64-unknown-linux-musl
|
||||||
|
EXTRA_FILES: "README.md LICENSE"
|
||||||
UPLOAD_MODE: none
|
UPLOAD_MODE: none
|
||||||
|
|
||||||
- name: Compile Windows - X86_64
|
- name: Compile Windows - X86_64
|
||||||
|
@ -27,6 +28,7 @@ jobs:
|
||||||
uses: rust-build/rust-build.action@v1.4.5
|
uses: rust-build/rust-build.action@v1.4.5
|
||||||
with:
|
with:
|
||||||
RUSTTARGET: x86_64-pc-windows-gnu
|
RUSTTARGET: x86_64-pc-windows-gnu
|
||||||
|
EXTRA_FILES: "README.md LICENSE"
|
||||||
UPLOAD_MODE: none
|
UPLOAD_MODE: none
|
||||||
|
|
||||||
# Broken: https://github.com/rust-build/rust-build.action/issues/88
|
# 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
|
# uses: rust-build/rust-build.action@v1.4.5
|
||||||
# with:
|
# with:
|
||||||
# RUSTTARGET: x86_64-apple-darwin
|
# RUSTTARGET: x86_64-apple-darwin
|
||||||
|
# EXTRA_FILES: "README.md LICENSE"
|
||||||
# UPLOAD_MODE: none
|
# UPLOAD_MODE: none
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
```
|
|
@ -3,16 +3,16 @@ use crate::utils::file::{ConfigFile, parse_path_string, write_config_file};
|
||||||
|
|
||||||
#[derive(Args, Debug)]
|
#[derive(Args, Debug)]
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
#[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")]
|
#[arg(long, help = "The entry directory or rask.yaml file")]
|
||||||
entry: String,
|
entry: Option<String>,
|
||||||
#[arg(help = "then name of the config file, defaults to the directory name", default_value = "")]
|
#[arg(help = "The rask config name, defaults to the directory name")]
|
||||||
name: String,
|
name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute(arguments: &Arguments) -> Result<(), String> {
|
pub fn execute(arguments: &Arguments) -> Result<(), String> {
|
||||||
let Arguments { entry, name } = arguments;
|
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() {
|
if path.is_dir() {
|
||||||
path.push("rask.yaml")
|
path.push("rask.yaml")
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ pub fn execute(arguments: &Arguments) -> Result<(), String> {
|
||||||
return Err(format!("Rask already initialised at {:?}", path));
|
return Err(format!("Rask already initialised at {:?}", path));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut config_name = name.clone(); // Use clone to avoid modifying the original input
|
let config_name: String;
|
||||||
if config_name.is_empty() {
|
if name.is_none() {
|
||||||
config_name = path.parent()
|
config_name = path.parent()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.file_name()
|
.file_name()
|
||||||
|
@ -30,6 +30,8 @@ pub fn execute(arguments: &Arguments) -> Result<(), String> {
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
} else {
|
||||||
|
config_name = name.clone().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let config_file: ConfigFile = ConfigFile {
|
let config_file: ConfigFile = ConfigFile {
|
||||||
|
|
|
@ -6,15 +6,15 @@ use crate::utils::file::ConfigFile;
|
||||||
|
|
||||||
#[derive(Args, Debug)]
|
#[derive(Args, Debug)]
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
#[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")]
|
#[arg(long, help = "The entry directory or rask.yaml file")]
|
||||||
entry: String,
|
entry: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
||||||
let Arguments { entry } = arguments;
|
let Arguments { entry } = arguments;
|
||||||
|
|
||||||
// Resolve the entry path
|
// 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
|
// Discover all config paths
|
||||||
let config_file_paths: Vec<PathBuf> = config::discover_config_paths(&entry_config_path)?;
|
let config_file_paths: Vec<PathBuf> = config::discover_config_paths(&entry_config_path)?;
|
||||||
|
|
|
@ -13,8 +13,8 @@ use crate::utils::file::ConfigFile;
|
||||||
pub struct Arguments {
|
pub struct Arguments {
|
||||||
#[arg(help = "Which task to run")]
|
#[arg(help = "Which task to run")]
|
||||||
task_name: String,
|
task_name: String,
|
||||||
#[arg(long, default_value = ".", help = "Which directory to use as entry, defaults to the current directory")]
|
#[arg(long, help = "The entry directory or rask.yaml file")]
|
||||||
entry: String,
|
entry: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
||||||
|
@ -24,7 +24,7 @@ pub fn execute (arguments: &Arguments) -> Result<(), String> {
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
|
|
||||||
// Resolve the entry path
|
// 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
|
// Discover all config paths
|
||||||
let config_file_paths: Vec<PathBuf> = config::discover_config_paths(&entry_config_path)?;
|
let config_file_paths: Vec<PathBuf> = config::discover_config_paths(&entry_config_path)?;
|
||||||
|
|
|
@ -9,13 +9,16 @@ mod utils;
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
enum Command {
|
enum Command {
|
||||||
|
/// Run specific tasks
|
||||||
Run(run::Arguments),
|
Run(run::Arguments),
|
||||||
|
/// List available tasks
|
||||||
List(list::Arguments),
|
List(list::Arguments),
|
||||||
|
/// Initialize a new rask entry
|
||||||
Init(init::Arguments),
|
Init(init::Arguments),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[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 {
|
struct Arguments {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Command
|
command: Command
|
||||||
|
|
Loading…
Reference in New Issue