about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 09:03:01 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 09:03:01 +0200
commitce5524775bb7a7f34f92ee732c7e4df29142cf00 (patch)
tree8ce8b3fcd3682de5a6950b5088ebf475e0814a9b
parentfix(storage/schema.sql): Tell SQLite to perform type-checking (diff)
downloadyt-ce5524775bb7a7f34f92ee732c7e4df29142cf00.tar.gz
yt-ce5524775bb7a7f34f92ee732c7e4df29142cf00.zip
feat(cli): Add an explicit `subs export` subcommand
This subcommand is functionally identical with the previous `subs list --url`,
but semantically it improves the situation, by having symmetrical
`import` and `export` subcommands.
Diffstat (limited to '')
-rw-r--r--src/cli.rs8
-rw-r--r--src/main.rs18
2 files changed, 12 insertions, 14 deletions
diff --git a/src/cli.rs b/src/cli.rs
index ba92be3..6f5abd2 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -180,13 +180,11 @@ pub enum SubscriptionCommand {
         #[arg(short, long)]
         force: bool,
     },
+    /// Write all subscriptions in an format understood by `import`
+    Export {},
 
     /// List all subscriptions
-    List {
-        /// Only show the URLs
-        #[arg(short, long)]
-        url: bool,
-    },
+    List {},
 }
 
 #[derive(Clone, Debug, Args)]
diff --git a/src/main.rs b/src/main.rs
index 3852b8e..7852aa0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -108,17 +108,17 @@ async fn main() -> Result<()> {
                     .await
                     .context("Failed to remove a subscription")?;
             }
-            SubscriptionCommand::List { url } => {
+            SubscriptionCommand::List {} => {
                 let all_subs = get_subscriptions(&app).await?;
 
-                if url {
-                    for val in all_subs.0.values() {
-                        println!("{}", val.url);
-                    }
-                } else {
-                    for (key, val) in all_subs.0 {
-                        println!("{}: '{}'", key, val.url);
-                    }
+                for (key, val) in all_subs.0 {
+                    println!("{}: '{}'", key, val.url);
+                }
+            }
+            SubscriptionCommand::Export {} => {
+                let all_subs = get_subscriptions(&app).await?;
+                for val in all_subs.0.values() {
+                    println!("{}", val.url);
                 }
             }
             SubscriptionCommand::Import { file, force } => {