mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 12:58:45 +08:00
Add a new alias for m3t
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -599,7 +599,9 @@ pub fn export_script(
|
||||
}
|
||||
}
|
||||
}
|
||||
types::OutputScriptType::M3t | types::OutputScriptType::M3ta => {
|
||||
types::OutputScriptType::M3t
|
||||
| types::OutputScriptType::M3ta
|
||||
| types::OutputScriptType::M3tTxt => {
|
||||
let enc = get_output_encoding(arg);
|
||||
let s = output_scripts::m3t::M3tDumper::dump(&mes);
|
||||
let b = match utils::encoding::encode_string(enc, &s, false) {
|
||||
@@ -917,7 +919,9 @@ pub fn export_script(
|
||||
let mut f = utils::files::write_file(&f)?;
|
||||
f.write_all(&b)?;
|
||||
}
|
||||
types::OutputScriptType::M3t | types::OutputScriptType::M3ta => {
|
||||
types::OutputScriptType::M3t
|
||||
| types::OutputScriptType::M3ta
|
||||
| types::OutputScriptType::M3tTxt => {
|
||||
let enc = get_output_encoding(arg);
|
||||
let s = output_scripts::m3t::M3tDumper::dump(&mes);
|
||||
let b = utils::encoding::encode_string(enc, &s, false)?;
|
||||
@@ -1115,7 +1119,9 @@ pub fn import_script(
|
||||
}
|
||||
}
|
||||
}
|
||||
types::OutputScriptType::M3t | types::OutputScriptType::M3ta => {
|
||||
types::OutputScriptType::M3t
|
||||
| types::OutputScriptType::M3ta
|
||||
| types::OutputScriptType::M3tTxt => {
|
||||
let enc = get_output_encoding(arg);
|
||||
let b = match utils::files::read_file(&out_path) {
|
||||
Ok(b) => b,
|
||||
@@ -1357,7 +1363,9 @@ pub fn import_script(
|
||||
let s = utils::encoding::decode_to_string(enc, &b, true)?;
|
||||
serde_json::from_str::<Vec<types::Message>>(&s)?
|
||||
}
|
||||
types::OutputScriptType::M3t | types::OutputScriptType::M3ta => {
|
||||
types::OutputScriptType::M3t
|
||||
| types::OutputScriptType::M3ta
|
||||
| types::OutputScriptType::M3tTxt => {
|
||||
let enc = get_output_encoding(arg);
|
||||
let b = utils::files::read_file(&out_f)?;
|
||||
let s = utils::encoding::decode_to_string(enc, &b, true)?;
|
||||
|
||||
@@ -84,6 +84,8 @@ pub enum OutputScriptType {
|
||||
M3t,
|
||||
/// Same as M3t, buf different extension
|
||||
M3ta,
|
||||
/// Same as M3t, buf different extension
|
||||
M3tTxt,
|
||||
/// JSON which can be used for GalTransl
|
||||
Json,
|
||||
/// YAML (same as JSON, but with YAML syntax)
|
||||
@@ -105,6 +107,7 @@ impl AsRef<str> for OutputScriptType {
|
||||
match self {
|
||||
OutputScriptType::M3t => "m3t",
|
||||
OutputScriptType::M3ta => "m3ta",
|
||||
OutputScriptType::M3tTxt => "txt",
|
||||
OutputScriptType::Json => "json",
|
||||
OutputScriptType::Yaml => "yaml",
|
||||
OutputScriptType::Custom => "",
|
||||
|
||||
Reference in New Issue
Block a user