summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs41
1 files changed, 40 insertions, 1 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index d8d761da6..4f5d82be8 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -280,6 +280,12 @@ pub struct VendorFlags {
}
#[derive(Clone, Debug, Eq, PartialEq)]
+pub struct PublishFlags {
+ pub directory: String,
+ pub token: Option<String>,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq)]
pub enum DenoSubcommand {
Bench(BenchFlags),
Bundle(BundleFlags),
@@ -305,6 +311,8 @@ pub enum DenoSubcommand {
Types,
Upgrade(UpgradeFlags),
Vendor(VendorFlags),
+ // TODO:
+ Publish(PublishFlags),
}
impl DenoSubcommand {
@@ -715,7 +723,7 @@ impl Flags {
}
Bundle(_) | Completions(_) | Doc(_) | Fmt(_) | Init(_) | Install(_)
| Uninstall(_) | Jupyter(_) | Lsp | Lint(_) | Types | Upgrade(_)
- | Vendor(_) => None,
+ | Vendor(_) | Publish(_) => None,
}
}
@@ -911,6 +919,8 @@ pub fn flags_from_vec(args: Vec<String>) -> clap::error::Result<Flags> {
"uninstall" => uninstall_parse(&mut flags, &mut m),
"upgrade" => upgrade_parse(&mut flags, &mut m),
"vendor" => vendor_parse(&mut flags, &mut m),
+ // TODO:
+ "do-not-use-publish" => publish_parse(&mut flags, &mut m),
_ => unreachable!(),
}
} else {
@@ -1045,6 +1055,7 @@ fn clap_root() -> Command {
.subcommand(uninstall_subcommand())
.subcommand(lsp_subcommand())
.subcommand(lint_subcommand())
+ .subcommand(publish_subcommand())
.subcommand(repl_subcommand())
.subcommand(task_subcommand())
.subcommand(test_subcommand())
@@ -2302,6 +2313,27 @@ Remote modules and multiple modules may also be specified:
.arg(ca_file_arg()))
}
+fn publish_subcommand() -> Command {
+ Command::new("do-not-use-publish")
+ .hide(true)
+ .about("Publish a package to the Deno registry")
+ // TODO: .long_about()
+ .defer(|cmd| {
+ cmd.arg(
+ Arg::new("directory")
+ .help(
+ "The directory to the package, or workspace of packages to publish",
+ )
+ .value_hint(ValueHint::DirPath)
+ .required(true),
+ )
+ .arg(
+ Arg::new("token")
+ .help("The API token to use when publishing. If unset, interactive authentication will be used.")
+ )
+ })
+}
+
fn compile_args(app: Command) -> Command {
compile_args_without_check_args(app.arg(no_check_arg()))
}
@@ -3722,6 +3754,13 @@ fn vendor_parse(flags: &mut Flags, matches: &mut ArgMatches) {
});
}
+fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) {
+ flags.subcommand = DenoSubcommand::Publish(PublishFlags {
+ directory: matches.remove_one::<String>("directory").unwrap(),
+ token: matches.remove_one("token"),
+ });
+}
+
fn compile_args_parse(flags: &mut Flags, matches: &mut ArgMatches) {
compile_args_without_check_parse(flags, matches);
no_check_arg_parse(flags, matches);