-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::Parser; | ||
use gc_fs_backup::GcFsBackupBuilder; | ||
|
||
#[derive(Parser)] | ||
#[clap(version = "1.0", author = "Kody Low <[email protected]>")] | ||
struct Cli { | ||
/// Sets the database path to backup | ||
#[clap(long, value_name = "DB_PATH", env = "DB_PATH", required = true)] | ||
db_path: PathBuf, | ||
|
||
/// Sets the bucket ID for the backup | ||
#[clap(long, value_name = "BUCKET_ID", env = "BUCKET_ID", required = true)] | ||
bucket_id: String, | ||
|
||
/// Sets the credentials for accessing the storage | ||
#[clap(long, value_name = "CREDENTIAL", env = "CREDENTIAL", required = true)] | ||
credential: String, | ||
|
||
/// Sets the name for the backup | ||
#[clap(long, value_name = "BACKUP_NAME", env = "BACKUP_NAME")] | ||
backup_name: String, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let cli: Cli = Cli::parse(); | ||
|
||
let backup = GcFsBackupBuilder::new() | ||
.db_path(cli.db_path.into()) | ||
.bucket_id(cli.bucket_id.into()) | ||
.credential(cli.credential.into()) | ||
.backup_name(cli.backup_name.into()) | ||
.build(); | ||
backup.backup_directory_contents().await.unwrap(); | ||
} |