Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Jun 3, 2020
1 parent 37a14a8 commit 728dede
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ fn run() -> Result<(), failure::Error> {
let kv_namespace_specifier_group = ArgGroup::with_name("namespace-specifier")
.args(&["binding", "namespace-id"])
.required(true);
let kv_preview_arg = Arg::with_name("preview")
.help("applies the command to the preview namespace when combined with --binding")
.long("preview")
.takes_value(false);

// This arg is for any action that uses environments (e.g. KV subcommands, publish)
let environment_arg = Arg::with_name("env")
Expand Down Expand Up @@ -153,6 +157,7 @@ fn run() -> Result<(), failure::Error> {
.about("Put a key-value pair into a namespace")
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.arg(kv_preview_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(environment_arg.clone())
.arg(
Expand Down Expand Up @@ -197,6 +202,7 @@ fn run() -> Result<(), failure::Error> {
.about("Get a key's value from a namespace")
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.arg(kv_preview_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(environment_arg.clone())
.arg(
Expand All @@ -212,6 +218,7 @@ fn run() -> Result<(), failure::Error> {
.about("Delete a key and its value from a namespace")
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.arg(kv_preview_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(environment_arg.clone())
.arg(
Expand All @@ -227,6 +234,7 @@ fn run() -> Result<(), failure::Error> {
.about("List all keys in a namespace. Produces JSON output")
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.arg(kv_preview_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(environment_arg.clone())
.arg(
Expand All @@ -253,6 +261,7 @@ fn run() -> Result<(), failure::Error> {
.about("Upload multiple key-value pairs to a namespace")
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.arg(kv_preview_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(environment_arg.clone())
.arg(
Expand All @@ -268,6 +277,7 @@ fn run() -> Result<(), failure::Error> {
.arg(kv_binding_arg.clone())
.arg(kv_namespace_id_arg.clone())
.group(kv_namespace_specifier_group.clone())
.arg(kv_preview_arg.clone())
.arg(environment_arg.clone())
.about("Delete multiple keys and their values from a namespace")
.arg(
Expand Down Expand Up @@ -863,6 +873,10 @@ fn run() -> Result<(), failure::Error> {
} else if let Some(kv_matches) = matches.subcommand_matches("kv:key") {
let manifest = settings::toml::Manifest::new(config_path)?;
let user = settings::global_user::GlobalUser::new()?;
is_preview = matches.is_present("preview");
if is_preview {
println!("PREVIEW PASSED");
}

// Get environment and bindings
let (subcommand, subcommand_matches) = kv_matches.subcommand();
Expand Down Expand Up @@ -926,6 +940,7 @@ fn run() -> Result<(), failure::Error> {
} else if let Some(kv_matches) = matches.subcommand_matches("kv:bulk") {
let manifest = settings::toml::Manifest::new(config_path)?;
let user = settings::global_user::GlobalUser::new()?;
is_preview = matches.is_present("preview");

// Get environment and bindings
let (subcommand, subcommand_matches) = kv_matches.subcommand();
Expand Down

0 comments on commit 728dede

Please sign in to comment.