Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 159 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ thiserror = { version = "2.0" }
handlebars = "6.3"
html-escape = "0.2"
regex = "1.1"
path-clean = "1.0.1"

path-clean = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [
"env-filter",
"std",
"fmt",
] }
[dev-dependencies]
tempfile = "3"

Expand Down
42 changes: 42 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
fmt::Display,
io::{self, ErrorKind},
path::PathBuf,
};
Expand All @@ -15,6 +16,28 @@ pub enum Template {
Txt,
}

#[derive(Debug, Clone, ValueEnum, PartialEq)]
#[allow(non_camel_case_types)]
pub enum LogLevel {
error,
warn,
info,
debug,
trace,
}

impl Display for LogLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
LogLevel::error => write!(f, "error"),
LogLevel::warn => write!(f, "warn"),
LogLevel::info => write!(f, "info"),
LogLevel::debug => write!(f, "debug"),
LogLevel::trace => write!(f, "trace"),
}
}
}

#[derive(Subcommand, Debug)]
pub enum DiscoveryCommand {
/// Displays MCP server capability details in the terminal.
Expand Down Expand Up @@ -47,6 +70,9 @@ pub struct WriteOptions {
)]
pub template_string: Option<String>,

/// Specifies the logging level for the application (default: info)
#[arg(long, short)]
pub log_level: Option<LogLevel>,
/// Command and arguments to launch the MCP server.
#[arg(
value_name = "MCP Launch Command",
Expand Down Expand Up @@ -98,6 +124,10 @@ conflicts_with_all = ["template", "template_string"])]
)]
pub template_string: Option<String>,

/// Specifies the logging level for the application (default: info)
#[arg(long, short)]
pub log_level: Option<LogLevel>,

/// Command and arguments to launch the MCP server.
#[arg(
value_name = "MCP Launch Command",
Expand Down Expand Up @@ -127,6 +157,14 @@ impl DiscoveryCommand {
DiscoveryCommand::Print(print_args) => &print_args.mcp_server_cmd,
}
}

pub fn log_level(&self) -> &Option<LogLevel> {
match self {
DiscoveryCommand::Create(create_options) => &create_options.log_level,
DiscoveryCommand::Update(update_options) => &update_options.log_level,
DiscoveryCommand::Print(print_args) => &print_args.log_level,
}
}
}

#[derive(Parser, Debug)]
Expand Down Expand Up @@ -156,6 +194,10 @@ pub struct CommandArguments {
)]
pub template_string: Option<String>,

/// Specifies the logging level for the application (default: info)
#[arg(long, short)]
pub log_level: Option<LogLevel>,

/// Command and arguments to launch the MCP server.
#[arg(
value_name = "MCP Launch Command",
Expand Down
Loading