diff --git a/Cargo.toml b/Cargo.toml index 10b22e1..5737b06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "MIT" [dependencies] -clap = { version = "4.4.8", features = ["derive", "cargo"] } +clap = { version = "4.5.10", features = ["derive", "cargo"] } [lib] name = "jsonwith" diff --git a/src/bin/jsonwith.rs b/src/bin/jsonwith.rs index 95c6732..0f9c482 100644 --- a/src/bin/jsonwith.rs +++ b/src/bin/jsonwith.rs @@ -1,4 +1,4 @@ -use clap::{Args, Parser, Subcommand, crate_version, CommandFactory}; +use clap::{crate_version, Args, CommandFactory, Parser, Subcommand}; use std::io::IsTerminal; use jsonwith::{json2yaml, jsonformat, yaml2json}; @@ -7,7 +7,7 @@ use jsonwith::{json2yaml, jsonformat, yaml2json}; #[command( name = "jsonwith", about = "Toy JSON Parser & Formatter", - disable_help_subcommand = true, + disable_help_subcommand = true )] pub struct Cli { #[command(subcommand)] @@ -61,7 +61,7 @@ fn main() { } match args.action { - Some(Actions::Format(args)) => { + Some(Actions::Format(args)) => { let json = args.json.unwrap_or_else(|| read_stdin()); if json.len() == 0 { println!("Error: Missing required argument."); diff --git a/src/yaml/parse/context.rs b/src/yaml/parse/context.rs deleted file mode 100644 index e4cda6e..0000000 --- a/src/yaml/parse/context.rs +++ /dev/null @@ -1,37 +0,0 @@ -use crate::data::{kvs::Kvs, kv::Kv, path::Path, tokens::Tokens}; - -pub struct Context { - kvs: Kvs, - last_indent: usize, -} -impl Context { - pub fn new() -> Self { - Context { - kvs: Kvs::new(), - last_indent: 0, - } - } - - pub fn get_kvs(&self) -> Kvs { - self.kvs.clone() - } - - pub fn push(&mut self, path: Path, value: Tokens) { - self.kvs.push(Kv::with(path, value)); - } - - pub fn get_last_path(&self) -> Path { - if let Some(last) = self.kvs.list().last() { - return last.get_path(); - }; - Path::new() - } - - pub fn get_last_indent(&self) -> usize { - self.last_indent.clone() - } - - pub fn set_last_indent(&mut self, indent: usize) { - self.last_indent = indent; - } -}