aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-11-07 15:02:31 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-11-07 15:02:31 +0100
commitc6c6e63ba4ba6e1ba7e4b0a511f7d8df9c79b372 (patch)
tree7467cc98ae312b50fae9bbdb02b4ba6cce5ac697
parentfeat(yt/{cli,config}): Rewrite the config generation macro (diff)
downloadyt-c6c6e63ba4ba6e1ba7e4b0a511f7d8df9c79b372.zip
feat(yt/cmds/config): Implement showing the default config
-rw-r--r--crates/yt/src/commands/config/implm.rs5
-rw-r--r--crates/yt/src/commands/config/mod.rs12
2 files changed, 13 insertions, 4 deletions
diff --git a/crates/yt/src/commands/config/implm.rs b/crates/yt/src/commands/config/implm.rs
index 00c28a9..ecc8853 100644
--- a/crates/yt/src/commands/config/implm.rs
+++ b/crates/yt/src/commands/config/implm.rs
@@ -14,7 +14,10 @@ use anyhow::Result;
impl ConfigCommand {
pub(in crate::commands) fn implm(self, app: &App) -> Result<()> {
- let config_str = toml::to_string(&app.config)?;
+ let config_str = match self {
+ ConfigCommand::Show {} => toml::to_string(&app.config)?,
+ ConfigCommand::Default {} => crate::config::def::Config::config_doc().to_string(),
+ };
print!("{config_str}");
diff --git a/crates/yt/src/commands/config/mod.rs b/crates/yt/src/commands/config/mod.rs
index 503b4f7..a125903 100644
--- a/crates/yt/src/commands/config/mod.rs
+++ b/crates/yt/src/commands/config/mod.rs
@@ -8,9 +8,15 @@
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-use clap::Parser;
+use clap::Subcommand;
mod implm;
-#[derive(Parser, Debug)]
-pub(super) struct ConfigCommand {}
+#[derive(Subcommand, Debug)]
+pub(super) enum ConfigCommand {
+ /// Show the current config, with all command-line overrides applied.
+ Show {},
+
+ /// Print the default configuration with documentation comments.
+ Default {},
+}