From 7de7a2f07ef8882148303eb4e97417467a898de3 Mon Sep 17 00:00:00 2001 From: Yevheniy Oliynyk Date: Sun, 5 May 2024 17:30:01 +0200 Subject: [PATCH] feat: completion script --- .../cli/commands/picocli/CompletionSubCommand.java | 8 ++++++++ .../com/crowdin/cli/commands/picocli/RootCommand.java | 3 ++- website/docs/intro.md | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/crowdin/cli/commands/picocli/CompletionSubCommand.java diff --git a/src/main/java/com/crowdin/cli/commands/picocli/CompletionSubCommand.java b/src/main/java/com/crowdin/cli/commands/picocli/CompletionSubCommand.java new file mode 100644 index 00000000..537c1c98 --- /dev/null +++ b/src/main/java/com/crowdin/cli/commands/picocli/CompletionSubCommand.java @@ -0,0 +1,8 @@ +package com.crowdin.cli.commands.picocli; + +import picocli.AutoComplete; +import picocli.CommandLine; + +@CommandLine.Command(name = "completion", hidden = true) +class CompletionSubCommand extends AutoComplete.GenerateCompletion { +} diff --git a/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java b/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java index ff475925..d64b1aab 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java @@ -24,7 +24,8 @@ FileSubcommand.class, LanguageSubcommand.class, ConfigSubcommand.class, - ProjectSubcommand.class + ProjectSubcommand.class, + CompletionSubCommand.class }) class RootCommand extends HelpCommand { @Override diff --git a/website/docs/intro.md b/website/docs/intro.md index 97e7e951..657e6d73 100644 --- a/website/docs/intro.md +++ b/website/docs/intro.md @@ -107,6 +107,12 @@ For [DEB](/installation#debian), [RPM](/installation#rpm), and [ArchLinux](/inst ::: +However, Crowdin CLI also comes with built-in subcommand to generate completion script for you: + +```bash +crowdin completion +``` + ## Requirements Check that you have Java 8 or newer installed. Type `java -version` command in the terminal (Command Prompt on Windows) to check Java version. For example, java version "1.8.0_212" means that you have Java 8 Update 212 installed.