display name in clap is buggy

This commit is contained in:
pedrocarlo 2025-03-07 15:27:14 -03:00
parent 02c466cb1f
commit fe25035c7c
7 changed files with 78 additions and 143 deletions

View file

@ -1,7 +1,7 @@
use crate::{
commands::{args::EchoMode, import::ImportFile, Command, CommandParser},
helper::LimboHelper,
input::{get_io, get_writer, DbLocation, OutputMode, Settings},
input::{get_io, get_writer, DbLocation, Io, OutputMode, Settings},
opcodes_dictionary::OPCODE_DESCRIPTIONS,
};
use comfy_table::{Attribute, Cell, CellAlignment, Color, ContentArrangement, Row, Table};
@ -308,11 +308,6 @@ impl<'a> Limbo<'a> {
EchoMode::On => self.opts.echo = true,
EchoMode::Off => self.opts.echo = false,
}
// match arg.trim().to_lowercase().as_str() {
// "on" => self.opts.echo = true,
// "off" => self.opts.echo = false,
// _ => {}
// }
}
fn open_db(&mut self, path: &str, vfs_name: Option<&str>) -> anyhow::Result<()> {
@ -471,18 +466,12 @@ impl<'a> Limbo<'a> {
if args.is_empty() {
return;
}
// else {
// // let _ = self.write_fmt(format_args!(
// // "Unknown command: {}\nenter: .help for all available commands",
// // args[0]
// // ));
match CommandParser::try_parse_from(args) {
Err(err) => {
let _ = self.write_fmt(format_args!("{err}"));
}
Ok(cmd) => match cmd.command {
Command::Exit(args) => {
// let code = args.get(1).and_then(|c| c.parse::<i32>().ok()).unwrap_or(0);
std::process::exit(args.code);
}
Command::Quit => {
@ -526,16 +515,6 @@ impl<'a> Limbo<'a> {
let _ = self.write_fmt(format_args!("{}", e));
}
}
// OutputMode::from_str(args[1], true) {
// Ok(mode) => {
// if let Err(e) = self.set_mode(mode) {
// let _ = self.write_fmt(format_args!("Error: {}", e));
// }
// }
// Err(e) => {
// let _ = self.writeln(e);
// }
// },
Command::SetOutput(args) => {
if let Some(path) = args.path {
if let Err(e) = self.set_output_file(&path) {
@ -554,16 +533,10 @@ impl<'a> Limbo<'a> {
Command::ShowInfo => {
let _ = self.show_info();
}
// Command::Help => {
// let _ = self.writeln(HELP_MSG);
// }
Command::Import(args) => {
let mut import_file =
ImportFile::new(self.conn.clone(), self.io.clone(), &mut self.writer);
import_file.import(args)
// if let Err(e) = import_file.import(args) {
// let _ = self.writeln(e.to_string());
// };
}
Command::LoadExtension(args) => {
#[cfg(not(target_family = "wasm"))]