From f59d1e9dfac55d350b7a22711ca3a98bf15e24b4 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 5 Feb 2026 12:42:33 -0800 Subject: [PATCH 1/2] Fix for Dart and Flutter commands Flagged the old dart completion as outdated --- .../auto-generate/completions/dart.nu | 4 +- custom-completions/dart/dart-completions.nu | 55 +++++++++++++ .../flutter/flutter-completions.nu | 80 +++++++++++++------ 3 files changed, 113 insertions(+), 26 deletions(-) create mode 100644 custom-completions/dart/dart-completions.nu diff --git a/custom-completions/auto-generate/completions/dart.nu b/custom-completions/auto-generate/completions/dart.nu index 17ffe4b58..6dc5acc1c 100644 --- a/custom-completions/auto-generate/completions/dart.nu +++ b/custom-completions/auto-generate/completions/dart.nu @@ -1,5 +1,7 @@ # Print this usage information. +print "Warning: This auto-generated completion is deprecated. Please use 'custom-completions/dart/dart-completions.nu' instead." + extern "dart" [ ...args -] \ No newline at end of file +] diff --git a/custom-completions/dart/dart-completions.nu b/custom-completions/dart/dart-completions.nu new file mode 100644 index 000000000..eae573881 --- /dev/null +++ b/custom-completions/dart/dart-completions.nu @@ -0,0 +1,55 @@ +def "nu-complete dart commands" [] { + ^dart --help + | lines + | skip until { $in | str contains "Available commands:" } + | where { $in | str starts-with " " } # Indented lines + | where { |line| not ($line | str trim | str starts-with "-") } # Ignore options + | each { + str trim + | str replace --regex '\s+' ' ' + | parse "{value} {description}" + } + | flatten + | where value not-in ["pub" "create"] +} + +def "nu-complete dart pub commands" [] { + ^dart pub --help + | lines + | skip until { $in | str contains "Available subcommands:" } + | where { $in | str starts-with " " } + | where { |line| not ($line | str trim | str starts-with "-") } + | each { + str trim + | str replace --regex '\s+' ' ' + | parse "{value} {description}" + } + | flatten +} + +def "nu-complete dart templates" [] { + [cli console package server-shelf web] +} + +export extern "dart" [ + command?: string@"nu-complete dart commands" + --help(-h) # Print this usage information. + --verbose(-v) # Print detailed logging. + --version # Print the VM version. + --enable-analytics # Enable telemetry reporting. + --disable-analytics # Disable telemetry reporting. + --suppress-analytics # Suppress analytics reporting for the current CLI invocation. +] + +export extern "dart create" [ + directory: string # Output directory + --template(-t): string@"nu-complete dart templates" # The project template to use + --pub # Run "pub get" after creation (default) + --no-pub # Do not run "pub get" + --force # Force project generation, even if the target directory already exists + --help(-h) # Print this usage information +] + +export extern "dart pub" [ + command?: string@"nu-complete dart pub commands" +] diff --git a/custom-completions/flutter/flutter-completions.nu b/custom-completions/flutter/flutter-completions.nu index 4b393e06b..29e9bd7f6 100644 --- a/custom-completions/flutter/flutter-completions.nu +++ b/custom-completions/flutter/flutter-completions.nu @@ -1,41 +1,71 @@ +def "nu-complete flutter commands" [] { + ^flutter --help --verbose + | lines + | skip until { $in | str contains "Available commands:" } + | where { $in | str starts-with " " } # Indented lines + | where { |line| not ($line | str trim | str starts-with "-") } # Ignore options + | each { + str trim + | str replace --regex '\s+' ' ' + | parse "{value} {description}" + } + | flatten + | where value not-in ["pub" "create"] +} + +def "nu-complete pub commands" [] { + ^flutter pub --help + | lines + | skip until { $in | str contains "Available subcommands:" } + | where { $in | str starts-with " " } + | where { |line| not ($line | str trim | str starts-with "-") } + | each { + str trim + | str replace --regex '\s+' ' ' + | parse "{value} {description}" + } + | flatten +} + +def "nu-complete android-languages" [] { + [java kotlin] +} + +def "nu-complete project-templates" [] { + [app module package package_ffi plugin plugin_ffi skeleton] +} + +def "nu-complete platforms" [] { + [ios android windows linux macos web] +} + export extern "flutter" [ command?: string@"nu-complete flutter commands" --help(-h) # Print this usage information. --verbose(-v) # Noisy logging, including all shell commands executed. - --device-id(-d) # Target device id or name (prefixes allowed). + --device-id(-d): string # Target device id or name (prefixes allowed). --version # Reports the version of this tool. --enable-analytics # Enable telemetry reporting each time a flutter or dart command runs. --disable-analytics # Disable telemetry reporting each time a flutter or dart command runs, until it is re-enabled. --suppress-analytics # Suppress analytics reporting for the current CLI invocation. ] -def "nu-complete flutter commands" [] { - ^flutter --help - | into string - | str replace --regex --multiline '(Manage[\s\S]*(?=Flutter SDK))' '' - | lines - | where { str starts-with " " } - | each { str trim } - | parse "{value} {description}" - | str trim -} - export extern "flutter create" [ - project: string # project to create + output_dir: string # Output directory + --pub # Run "flutter pub get" after creation (default) + --no-pub # Do not run "flutter pub get" + --offline # Run "flutter pub get" in offline mode + --overwrite # Overwrite existing files + --description: string # The description to use for your new Flutter project + --org: string # The organization responsible for your new Flutter project + --project-name: string # The project name for this new Flutter project + --android-language(-a): string@"nu-complete android-languages" # The language to use for Android-specific code + --platforms: string@"nu-complete platforms" # The platforms supported by this project + --template(-t): string@"nu-complete project-templates" # Specify the type of project to create + --empty(-e) # Specifies creating using an application template with a main.dart that is minimal + --help(-h) # Print this usage information ] export extern "flutter pub" [ command?: string@"nu-complete pub commands" ] - -def "nu-complete pub commands" [] { - ^flutter pub --help - | into string - | str replace --regex --multiline '(Commands[\s\S]*(?=Available subcommands))' '' - | lines - | where { str starts-with " " } - | each { str trim } - | parse "{value} {description}" - | str trim -} - From ea3b7f156ae362fda667e1547c3600e3a59a7b56 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Thu, 5 Feb 2026 12:49:56 -0800 Subject: [PATCH 2/2] or just delete it --- custom-completions/auto-generate/completions/dart.nu | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 custom-completions/auto-generate/completions/dart.nu diff --git a/custom-completions/auto-generate/completions/dart.nu b/custom-completions/auto-generate/completions/dart.nu deleted file mode 100644 index 6dc5acc1c..000000000 --- a/custom-completions/auto-generate/completions/dart.nu +++ /dev/null @@ -1,7 +0,0 @@ -# Print this usage information. -print "Warning: This auto-generated completion is deprecated. Please use 'custom-completions/dart/dart-completions.nu' instead." - -extern "dart" [ - - ...args -]