Skip to content

Complete parameters of tasks #97

Description

@mrdgo

Is your feature request related to a problem? Please describe.

Usually, I run nur run. I set all globally sensible defaults in the nurfile and all local defaults in .nur/env.nu. But whenever I want a single invocation to use different parameters, I have to 1. memorize which ones it takes and 2. what type of argument it accepts. My main entry point got a bit messy:

def "nur run" [
  --test-case (-t): path@"nu-complete test" = "EMPTY" # Path to project to split
  --run-wrapper (-w) # whether to (re-)run this wrapper
  --run-split (-s) # whether to run `split`
  --build-enclaves (-e) # run make in $project
  --run-final-app (-a) # run final compartmentalized app
  --clone-artifact (-c) # only clone artifact to ssgx1
  --abstract (-A) # debugging only: run abstract lint
  --run-policy (-p) # run policy, otherwise requires one in schemata/*
  --collect-bounds (-l) # construct a call graph
  --in-gitlab-ci # then don't run -e in docker
  --server-dir-suffix (-S): string = ""
  --policy: string = "limitations-driven"
  --schema: path@"nu-complete path" = "EMPTY"
  --call-graph: path@"nu-complete path" = "EMPTY"
  --project: path@"nu-complete path" = "EMPTY"
  --target-dir: path@"nu-complete path" = "App"
  --skip-clean (-C)
] {
  ...
}

As you can see, I already tried to implement completions for certain parameters:

def "nu-complete path" [
  prefix: string
] {
  let word = $prefix | split row -r '\s+' | last
  glob $"($word)*" | path relative-to $env.PWD
}

def "nu-complete test" [prefix: string] {
  let word = $prefix | split row -r '\s+' | last
  glob $"tests/($word)*" | path relative-to $"($env.PWD)/tests"
}

But sadly, neither can nu complete the parameter names, nor their arguments.

Describe the solution you'd like

(I feel like this might be difficult to pull off, but)
I'd really enjoy being able to just type nur run --<tab> and get completion options. The same way, when I selected an option, I want to hit tab again and get the desired nu-complete completions.

Describe alternatives you've considered

I tried the aforementioned nu-complete syntax from vanilla nu.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions