Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backup: add command #785

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Draft
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
6 changes: 4 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod backup;
pub mod bucket;
pub mod cache;
pub mod cat;
Expand All @@ -8,7 +9,6 @@ pub mod depends;
pub mod describe;
#[cfg(feature = "download")]
pub mod download;
pub mod export;
pub mod home;
pub mod hook;
pub mod info;
Expand Down Expand Up @@ -140,8 +140,10 @@ pub enum Commands {
Home(home::Args),
/// Show content of specified manifest
Cat(cat::Args),
#[cfg(not(feature = "v2"))]
#[cfg_attr(not(feature = "v2"), command_name = "backup export")]
/// Exports installed apps, buckets (and optionally configs) in JSON format
Export(export::Args),
Export(backup::export::Args),
/// Check for common issues
Checkup(checkup::Args),
#[cfg(feature = "download")]
Expand Down
25 changes: 25 additions & 0 deletions src/commands/backup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use clap::{Parser, Subcommand};
use sfsu_derive::Runnable;
use sprinkles::{config, contexts::ScoopContext};

use super::{Command, CommandRunner};

pub mod export;

#[derive(Debug, Clone, Subcommand, Runnable)]
pub enum Commands {
/// Exports installed apps, buckets (and optionally configs) in JSON format
Export(export::Args),
}

#[derive(Debug, Clone, Parser)]
pub struct Args {
#[clap(subcommand)]
command: Commands,
}

impl super::Command for Args {
async fn runner(self, ctx: &impl ScoopContext<config::Scoop>) -> anyhow::Result<()> {
self.command.run(ctx).await
}
}
File renamed without changes.