feat: v0.4.0, change js to ts
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -864,7 +864,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "runrs"
|
name = "runrs"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argh",
|
"argh",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "runrs"
|
name = "runrs"
|
||||||
version = "0.3.0"
|
version = "0.4.0"
|
||||||
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"
|
||||||
@@ -12,7 +12,7 @@ readme = "README.md"
|
|||||||
default = ["switch-rust-lang"]
|
default = ["switch-rust-lang"]
|
||||||
switch-rust-lang = []
|
switch-rust-lang = []
|
||||||
switch-go-lang = []
|
switch-go-lang = []
|
||||||
switch-js-lang = []
|
switch-ts-lang = []
|
||||||
switch-dart-lang = []
|
switch-dart-lang = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
18
justfile
18
justfile
@@ -10,8 +10,8 @@ run-rust *args:
|
|||||||
run-go *args:
|
run-go *args:
|
||||||
cargo run --no-default-features --features switch-go-lang -- {{args}}
|
cargo run --no-default-features --features switch-go-lang -- {{args}}
|
||||||
|
|
||||||
run-js *args:
|
run-ts *args:
|
||||||
cargo run --no-default-features --features switch-js-lang -- {{args}}
|
cargo run --no-default-features --features switch-ts-lang -- {{args}}
|
||||||
|
|
||||||
run-dart *args:
|
run-dart *args:
|
||||||
cargo run --no-default-features --features switch-dart-lang -- {{args}}
|
cargo run --no-default-features --features switch-dart-lang -- {{args}}
|
||||||
@@ -22,8 +22,8 @@ build-run-rust:
|
|||||||
build-run-go:
|
build-run-go:
|
||||||
cargo build --release --no-default-features --features switch-go-lang
|
cargo build --release --no-default-features --features switch-go-lang
|
||||||
|
|
||||||
build-run-js:
|
build-run-ts:
|
||||||
cargo build --release --no-default-features --features switch-js-lang
|
cargo build --release --no-default-features --features switch-ts-lang
|
||||||
|
|
||||||
build-run-dart:
|
build-run-dart:
|
||||||
cargo build --release --no-default-features --features switch-dart-lang
|
cargo build --release --no-default-features --features switch-dart-lang
|
||||||
@@ -32,9 +32,9 @@ install-run-go:
|
|||||||
cargo build --release --no-default-features --features switch-go-lang
|
cargo build --release --no-default-features --features switch-go-lang
|
||||||
cp target/release/runrs ~/bin/rungo
|
cp target/release/runrs ~/bin/rungo
|
||||||
|
|
||||||
install-run-js:
|
install-run-ts:
|
||||||
cargo build --release --no-default-features --features switch-js-lang
|
cargo build --release --no-default-features --features switch-ts-lang
|
||||||
cp target/release/runrs ~/bin/runjss
|
cp target/release/runrs ~/bin/runts
|
||||||
|
|
||||||
install-run-dart:
|
install-run-dart:
|
||||||
cargo build --release --no-default-features --features switch-dart-lang
|
cargo build --release --no-default-features --features switch-dart-lang
|
||||||
@@ -43,11 +43,11 @@ install-run-dart:
|
|||||||
build-all:
|
build-all:
|
||||||
@just build-run-rust
|
@just build-run-rust
|
||||||
@just build-run-go
|
@just build-run-go
|
||||||
@just build-run-js
|
@just build-run-ts
|
||||||
@just build-run-dart
|
@just build-run-dart
|
||||||
|
|
||||||
install-all:
|
install-all:
|
||||||
@just install
|
@just install
|
||||||
@just install-run-go
|
@just install-run-go
|
||||||
@just install-run-js
|
@just install-run-ts
|
||||||
@just install-run-dart
|
@just install-run-dart
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
pub fn print_help() {
|
|
||||||
println!(r##"runjs v{} - A Tool for Run JS Scripts
|
|
||||||
|
|
||||||
Show help:
|
|
||||||
$ runjs -h|--help
|
|
||||||
|
|
||||||
Show template:
|
|
||||||
$ runjs -t|--template [--output script.js]
|
|
||||||
|
|
||||||
Show scriptions:
|
|
||||||
$ runjs -l|--list
|
|
||||||
|
|
||||||
Install script:
|
|
||||||
$ runjs -i|--install <script.js>
|
|
||||||
|
|
||||||
"##,
|
|
||||||
env!("CARGO_PKG_VERSION")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
19
src/help_ts.rs
Normal file
19
src/help_ts.rs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
pub fn print_help() {
|
||||||
|
println!(r##"runts v{} - A Tool for Run TS Scripts
|
||||||
|
|
||||||
|
Show help:
|
||||||
|
$ runts -h|--help
|
||||||
|
|
||||||
|
Show template:
|
||||||
|
$ runts -t|--template [--output script.ts]
|
||||||
|
|
||||||
|
Show scriptions:
|
||||||
|
$ runts -l|--list
|
||||||
|
|
||||||
|
Install script:
|
||||||
|
$ runts -i|--install <script.ts>
|
||||||
|
|
||||||
|
"##,
|
||||||
|
env!("CARGO_PKG_VERSION")
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -11,9 +11,9 @@ const SCRIPT_PATTERN: &str =
|
|||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
const SCRIPT_PATTERN: &str =
|
const SCRIPT_PATTERN: &str =
|
||||||
"https://git.hatter.ink/hatter/go-scripts/raw/branch/main/$NAME/main.go";
|
"https://git.hatter.ink/hatter/go-scripts/raw/branch/main/$NAME/main.go";
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
const SCRIPT_PATTERN: &str =
|
const SCRIPT_PATTERN: &str =
|
||||||
"https://git.hatter.ink/hatter/js-scripts/raw/branch/main/$NAME/main.js";
|
"https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/$NAME/main.ts";
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
const SCRIPT_PATTERN: &str =
|
const SCRIPT_PATTERN: &str =
|
||||||
"https://git.hatter.ink/hatter/dart-scripts/raw/branch/main/$NAME/main.dart";
|
"https://git.hatter.ink/hatter/dart-scripts/raw/branch/main/$NAME/main.dart";
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use crate::util::{SCRIPT_DOT_EXT, SCRIPT_HYPHEN_EXT};
|
|||||||
const FILE_META: &str = "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/script-meta.json";
|
const FILE_META: &str = "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/script-meta.json";
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
const FILE_META: &str = "https://git.hatter.ink/hatter/go-scripts/raw/branch/main/script-meta.json";
|
const FILE_META: &str = "https://git.hatter.ink/hatter/go-scripts/raw/branch/main/script-meta.json";
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
const FILE_META: &str = "https://git.hatter.ink/hatter/js-scripts/raw/branch/main/script-meta.json";
|
const FILE_META: &str = "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/script-meta.json";
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
const FILE_META: &str = "https://git.hatter.ink/hatter/dart-scripts/raw/branch/main/script-meta.json";
|
const FILE_META: &str = "https://git.hatter.ink/hatter/dart-scripts/raw/branch/main/script-meta.json";
|
||||||
|
|
||||||
|
|||||||
18
src/main.rs
18
src/main.rs
@@ -16,8 +16,8 @@ use crate::util::{
|
|||||||
mod help_dart;
|
mod help_dart;
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
mod help_go;
|
mod help_go;
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
mod help_js;
|
mod help_ts;
|
||||||
#[cfg(feature = "switch-rust-lang")]
|
#[cfg(feature = "switch-rust-lang")]
|
||||||
mod help_rs;
|
mod help_rs;
|
||||||
mod install;
|
mod install;
|
||||||
@@ -28,8 +28,8 @@ mod util;
|
|||||||
const CMD_NAME: &str = "runrs";
|
const CMD_NAME: &str = "runrs";
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
const CMD_NAME: &str = "rungo";
|
const CMD_NAME: &str = "rungo";
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
const CMD_NAME: &str = "runjs";
|
const CMD_NAME: &str = "runts";
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
const CMD_NAME: &str = "rundart";
|
const CMD_NAME: &str = "rundart";
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "switch-go-lang",
|
feature = "switch-go-lang",
|
||||||
feature = "switch-js-lang",
|
feature = "switch-ts-lang",
|
||||||
feature = "switch-dart-lang"
|
feature = "switch-dart-lang"
|
||||||
))]
|
))]
|
||||||
if true {
|
if true {
|
||||||
@@ -134,8 +134,8 @@ fn print_help() {
|
|||||||
help_rs::print_help();
|
help_rs::print_help();
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
help_go::print_help();
|
help_go::print_help();
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
help_js::print_help();
|
help_ts::print_help();
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
help_dart::print_help();
|
help_dart::print_help();
|
||||||
}
|
}
|
||||||
@@ -145,8 +145,8 @@ fn print_template(output: &Option<String>) {
|
|||||||
let script = include_str!("script.template.rs");
|
let script = include_str!("script.template.rs");
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
let script = include_str!("script.template.go");
|
let script = include_str!("script.template.go");
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
let script = include_str!("script.template.js");
|
let script = include_str!("script.template.ts");
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
let script = include_str!("script.template.dart");
|
let script = include_str!("script.template.dart");
|
||||||
match output {
|
match output {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use std::{env, fs, process};
|
|||||||
pub const SCRIPT_HYPHEN_EXT: &str = "-rs";
|
pub const SCRIPT_HYPHEN_EXT: &str = "-rs";
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
pub const SCRIPT_HYPHEN_EXT: &str = "-go";
|
pub const SCRIPT_HYPHEN_EXT: &str = "-go";
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
pub const SCRIPT_HYPHEN_EXT: &str = "-js";
|
pub const SCRIPT_HYPHEN_EXT: &str = "-ts";
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
pub const SCRIPT_HYPHEN_EXT: &str = "-dart";
|
pub const SCRIPT_HYPHEN_EXT: &str = "-dart";
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@ pub const SCRIPT_HYPHEN_EXT: &str = "-dart";
|
|||||||
pub const SCRIPT_DOT_EXT: &str = ".rs";
|
pub const SCRIPT_DOT_EXT: &str = ".rs";
|
||||||
#[cfg(feature = "switch-go-lang")]
|
#[cfg(feature = "switch-go-lang")]
|
||||||
pub const SCRIPT_DOT_EXT: &str = ".go";
|
pub const SCRIPT_DOT_EXT: &str = ".go";
|
||||||
#[cfg(feature = "switch-js-lang")]
|
#[cfg(feature = "switch-ts-lang")]
|
||||||
pub const SCRIPT_DOT_EXT: &str = ".js";
|
pub const SCRIPT_DOT_EXT: &str = ".ts";
|
||||||
#[cfg(feature = "switch-dart-lang")]
|
#[cfg(feature = "switch-dart-lang")]
|
||||||
pub const SCRIPT_DOT_EXT: &str = ".dart";
|
pub const SCRIPT_DOT_EXT: &str = ".dart";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user