feat: v0.4.0, change js to ts
This commit is contained in:
@@ -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")]
|
||||
const SCRIPT_PATTERN: &str =
|
||||
"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 =
|
||||
"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")]
|
||||
const SCRIPT_PATTERN: &str =
|
||||
"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";
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
const FILE_META: &str = "https://git.hatter.ink/hatter/go-scripts/raw/branch/main/script-meta.json";
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
const FILE_META: &str = "https://git.hatter.ink/hatter/js-scripts/raw/branch/main/script-meta.json";
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
const FILE_META: &str = "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/script-meta.json";
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
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;
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
mod help_go;
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
mod help_js;
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
mod help_ts;
|
||||
#[cfg(feature = "switch-rust-lang")]
|
||||
mod help_rs;
|
||||
mod install;
|
||||
@@ -28,8 +28,8 @@ mod util;
|
||||
const CMD_NAME: &str = "runrs";
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
const CMD_NAME: &str = "rungo";
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
const CMD_NAME: &str = "runjs";
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
const CMD_NAME: &str = "runts";
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
const CMD_NAME: &str = "rundart";
|
||||
|
||||
@@ -100,7 +100,7 @@ fn main() {
|
||||
|
||||
#[cfg(any(
|
||||
feature = "switch-go-lang",
|
||||
feature = "switch-js-lang",
|
||||
feature = "switch-ts-lang",
|
||||
feature = "switch-dart-lang"
|
||||
))]
|
||||
if true {
|
||||
@@ -134,8 +134,8 @@ fn print_help() {
|
||||
help_rs::print_help();
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
help_go::print_help();
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
help_js::print_help();
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
help_ts::print_help();
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
help_dart::print_help();
|
||||
}
|
||||
@@ -145,8 +145,8 @@ fn print_template(output: &Option<String>) {
|
||||
let script = include_str!("script.template.rs");
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
let script = include_str!("script.template.go");
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
let script = include_str!("script.template.js");
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
let script = include_str!("script.template.ts");
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
let script = include_str!("script.template.dart");
|
||||
match output {
|
||||
|
||||
@@ -9,8 +9,8 @@ use std::{env, fs, process};
|
||||
pub const SCRIPT_HYPHEN_EXT: &str = "-rs";
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
pub const SCRIPT_HYPHEN_EXT: &str = "-go";
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
pub const SCRIPT_HYPHEN_EXT: &str = "-js";
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
pub const SCRIPT_HYPHEN_EXT: &str = "-ts";
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
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";
|
||||
#[cfg(feature = "switch-go-lang")]
|
||||
pub const SCRIPT_DOT_EXT: &str = ".go";
|
||||
#[cfg(feature = "switch-js-lang")]
|
||||
pub const SCRIPT_DOT_EXT: &str = ".js";
|
||||
#[cfg(feature = "switch-ts-lang")]
|
||||
pub const SCRIPT_DOT_EXT: &str = ".ts";
|
||||
#[cfg(feature = "switch-dart-lang")]
|
||||
pub const SCRIPT_DOT_EXT: &str = ".dart";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user