|
| 1 | +def "nu-complete flutter commands" [] { |
| 2 | + ^flutter --help --verbose |
| 3 | + | lines |
| 4 | + | skip until { $in | str contains "Available commands:" } |
| 5 | + | where { $in | str starts-with " " } # Indented lines |
| 6 | + | where { |line| not ($line | str trim | str starts-with "-") } # Ignore options |
| 7 | + | each { |
| 8 | + str trim |
| 9 | + | str replace --regex '\s+' ' ' |
| 10 | + | parse "{value} {description}" |
| 11 | + } |
| 12 | + | flatten |
| 13 | + | where value not-in ["pub" "create"] |
| 14 | +} |
| 15 | + |
| 16 | +def "nu-complete pub commands" [] { |
| 17 | + ^flutter pub --help |
| 18 | + | lines |
| 19 | + | skip until { $in | str contains "Available subcommands:" } |
| 20 | + | where { $in | str starts-with " " } |
| 21 | + | where { |line| not ($line | str trim | str starts-with "-") } |
| 22 | + | each { |
| 23 | + str trim |
| 24 | + | str replace --regex '\s+' ' ' |
| 25 | + | parse "{value} {description}" |
| 26 | + } |
| 27 | + | flatten |
| 28 | +} |
| 29 | + |
| 30 | +def "nu-complete android-languages" [] { |
| 31 | + [java kotlin] |
| 32 | +} |
| 33 | + |
| 34 | +def "nu-complete project-templates" [] { |
| 35 | + [app module package package_ffi plugin plugin_ffi skeleton] |
| 36 | +} |
| 37 | + |
| 38 | +def "nu-complete platforms" [] { |
| 39 | + [ios android windows linux macos web] |
| 40 | +} |
| 41 | + |
1 | 42 | export extern "flutter" [ |
2 | 43 | command?: string@"nu-complete flutter commands" |
3 | 44 | --help(-h) # Print this usage information. |
4 | 45 | --verbose(-v) # Noisy logging, including all shell commands executed. |
5 | | - --device-id(-d) # Target device id or name (prefixes allowed). |
| 46 | + --device-id(-d): string # Target device id or name (prefixes allowed). |
6 | 47 | --version # Reports the version of this tool. |
7 | 48 | --enable-analytics # Enable telemetry reporting each time a flutter or dart command runs. |
8 | 49 | --disable-analytics # Disable telemetry reporting each time a flutter or dart command runs, until it is re-enabled. |
9 | 50 | --suppress-analytics # Suppress analytics reporting for the current CLI invocation. |
10 | 51 | ] |
11 | 52 |
|
12 | | -def "nu-complete flutter commands" [] { |
13 | | - ^flutter --help |
14 | | - | into string |
15 | | - | str replace --regex --multiline '(Manage[\s\S]*(?=Flutter SDK))' '' |
16 | | - | lines |
17 | | - | where { str starts-with " " } |
18 | | - | each { str trim } |
19 | | - | parse "{value} {description}" |
20 | | - | str trim |
21 | | -} |
22 | | - |
23 | 53 | export extern "flutter create" [ |
24 | | - project: string # project to create |
| 54 | + output_dir: string # Output directory |
| 55 | + --pub # Run "flutter pub get" after creation (default) |
| 56 | + --no-pub # Do not run "flutter pub get" |
| 57 | + --offline # Run "flutter pub get" in offline mode |
| 58 | + --overwrite # Overwrite existing files |
| 59 | + --description: string # The description to use for your new Flutter project |
| 60 | + --org: string # The organization responsible for your new Flutter project |
| 61 | + --project-name: string # The project name for this new Flutter project |
| 62 | + --android-language(-a): string@"nu-complete android-languages" # The language to use for Android-specific code |
| 63 | + --platforms: string@"nu-complete platforms" # The platforms supported by this project |
| 64 | + --template(-t): string@"nu-complete project-templates" # Specify the type of project to create |
| 65 | + --empty(-e) # Specifies creating using an application template with a main.dart that is minimal |
| 66 | + --help(-h) # Print this usage information |
25 | 67 | ] |
26 | 68 |
|
27 | 69 | export extern "flutter pub" [ |
28 | 70 | command?: string@"nu-complete pub commands" |
29 | 71 | ] |
30 | | - |
31 | | -def "nu-complete pub commands" [] { |
32 | | - ^flutter pub --help |
33 | | - | into string |
34 | | - | str replace --regex --multiline '(Commands[\s\S]*(?=Available subcommands))' '' |
35 | | - | lines |
36 | | - | where { str starts-with " " } |
37 | | - | each { str trim } |
38 | | - | parse "{value} {description}" |
39 | | - | str trim |
40 | | -} |
41 | | - |
|
0 commit comments