feat: v1.1.6
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1221,7 +1221,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "runrs"
|
name = "runrs"
|
||||||
version = "1.1.5"
|
version = "1.1.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argh",
|
"argh",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "runrs"
|
name = "runrs"
|
||||||
version = "1.1.5"
|
version = "1.1.6"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "A Tool for Run Rust Scripts"
|
description = "A Tool for Run Rust Scripts"
|
||||||
|
|||||||
23
src/list.rs
23
src/list.rs
@@ -1,10 +1,16 @@
|
|||||||
|
use crate::install::install_scripts;
|
||||||
use crate::util;
|
use crate::util;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn list_scripts(script_repo: &Option<String>, filter: Option<&String>) {
|
pub fn list_scripts(
|
||||||
|
script_repo: &Option<String>,
|
||||||
|
filter: Option<&String>,
|
||||||
|
update_listed_scripts: bool,
|
||||||
|
) {
|
||||||
let script_meta_map = util::fetch_script_meta_or_die(script_repo);
|
let script_meta_map = util::fetch_script_meta_or_die(script_repo);
|
||||||
|
|
||||||
|
let mut matched_need_update_scripts = vec![];
|
||||||
let mut messages = vec![];
|
let mut messages = vec![];
|
||||||
for script_meta in script_meta_map.values() {
|
for script_meta in script_meta_map.values() {
|
||||||
let script_name = &script_meta.script_name;
|
let script_name = &script_meta.script_name;
|
||||||
@@ -34,6 +40,9 @@ pub fn list_scripts(script_repo: &Option<String>, filter: Option<&String>) {
|
|||||||
".".repeat(iff!(padding_length < 1, 1, padding_length)),
|
".".repeat(iff!(padding_length < 1, 1, padding_length)),
|
||||||
script_size,
|
script_size,
|
||||||
));
|
));
|
||||||
|
if is_script_exists && !is_script_matches {
|
||||||
|
matched_need_update_scripts.push(script_meta.script_name.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if filter.is_some() {
|
if filter.is_some() {
|
||||||
messages.insert(
|
messages.insert(
|
||||||
@@ -48,4 +57,16 @@ pub fn list_scripts(script_repo: &Option<String>, filter: Option<&String>) {
|
|||||||
messages.insert(0, format!("Found {} script(s):", script_meta_map.len()));
|
messages.insert(0, format!("Found {} script(s):", script_meta_map.len()));
|
||||||
}
|
}
|
||||||
success!("{}", messages.join("\n"));
|
success!("{}", messages.join("\n"));
|
||||||
|
|
||||||
|
if update_listed_scripts {
|
||||||
|
if matched_need_update_scripts.len() > 0 {
|
||||||
|
information!(
|
||||||
|
"Update listed scripts ON:\n- {}\n",
|
||||||
|
matched_need_update_scripts.join("\n- ")
|
||||||
|
);
|
||||||
|
install_scripts(script_repo, &matched_need_update_scripts);
|
||||||
|
} else {
|
||||||
|
information!("No update listed scripts");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/main.rs
13
src/main.rs
@@ -8,11 +8,11 @@ mod help;
|
|||||||
mod install;
|
mod install;
|
||||||
mod list;
|
mod list;
|
||||||
mod run_rs;
|
mod run_rs;
|
||||||
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
|
mod run_ts;
|
||||||
mod template;
|
mod template;
|
||||||
mod util;
|
mod util;
|
||||||
mod verify;
|
mod verify;
|
||||||
#[cfg(feature = "switch-ts-lang")]
|
|
||||||
mod run_ts;
|
|
||||||
|
|
||||||
#[derive(FromArgs, PartialEq, Debug)]
|
#[derive(FromArgs, PartialEq, Debug)]
|
||||||
/// Run script
|
/// Run script
|
||||||
@@ -29,6 +29,9 @@ struct RunScriptArgs {
|
|||||||
/// install script
|
/// install script
|
||||||
#[argh(switch, short = 'i')]
|
#[argh(switch, short = 'i')]
|
||||||
install: bool,
|
install: bool,
|
||||||
|
/// update listed scripts
|
||||||
|
#[argh(option)]
|
||||||
|
update_listed_scripts: Option<bool>,
|
||||||
/// script repo
|
/// script repo
|
||||||
#[argh(option, short = 'R')]
|
#[argh(option, short = 'R')]
|
||||||
script_repo: Option<String>,
|
script_repo: Option<String>,
|
||||||
@@ -59,7 +62,11 @@ fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if rs_args.list {
|
if rs_args.list {
|
||||||
list::list_scripts(&rs_args.script_repo, rs_args.arguments.first());
|
list::list_scripts(
|
||||||
|
&rs_args.script_repo,
|
||||||
|
rs_args.arguments.first(),
|
||||||
|
rs_args.update_listed_scripts.unwrap_or(false),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if rs_args.install {
|
if rs_args.install {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Show template:
|
|||||||
$ rundart -t|--template [--output script.dart]
|
$ rundart -t|--template [--output script.dart]
|
||||||
|
|
||||||
Show scriptions:
|
Show scriptions:
|
||||||
$ rundart -l|--list [filter]
|
$ rundart -l|--list [filter] [--update-listed-scripts]
|
||||||
|
|
||||||
Install script:
|
Install script:
|
||||||
$ rundart -i|--install <script.dart>
|
$ rundart -i|--install <script.dart>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Show template:
|
|||||||
$ rungo -t|--template [--output script.go]
|
$ rungo -t|--template [--output script.go]
|
||||||
|
|
||||||
Show scriptions:
|
Show scriptions:
|
||||||
$ rungo -l|--list [filter]
|
$ rungo -l|--list [filter] [--update-listed-scripts]
|
||||||
|
|
||||||
Install script:
|
Install script:
|
||||||
$ rungo -i|--install <script.go>
|
$ rungo -i|--install <script.go>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Show template:
|
|||||||
$ runrs -t|--template [--output script.rs]
|
$ runrs -t|--template [--output script.rs]
|
||||||
|
|
||||||
Show scriptions:
|
Show scriptions:
|
||||||
$ runrs [-R|--script-repo runrs] -l|--list [filter]
|
$ runrs [-R|--script-repo runrs] -l|--list [filter] [--update-listed-scripts]
|
||||||
|
|
||||||
Install script:
|
Install script:
|
||||||
$ runrs [-R|--script-repo runrs] -i|--install <script.rs>
|
$ runrs [-R|--script-repo runrs] -i|--install <script.rs>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Show template:
|
|||||||
$ runts -t|--template [--output script.ts]
|
$ runts -t|--template [--output script.ts]
|
||||||
|
|
||||||
Show scriptions:
|
Show scriptions:
|
||||||
$ runts -l|--list [filter]
|
$ runts -l|--list [filter] [--update-listed-scripts]
|
||||||
|
|
||||||
Install script:
|
Install script:
|
||||||
$ runts -i|--install <script.ts>
|
$ runts -i|--install <script.ts>
|
||||||
|
|||||||
Reference in New Issue
Block a user