Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nu-complete kube deploys and pods #682

Merged
merged 3 commits into from
Dec 2, 2023
Merged

nu-complete kube deploys and pods #682

merged 3 commits into from
Dec 2, 2023

Conversation

fj0r
Copy link
Contributor

@fj0r fj0r commented Dec 1, 2023

  • update kadm check and kadm renew
  • refactor nu-complete kube pods or deploys to nu-complete kube deploys and pods

in #680, nu-complete kube pods changed to pods or deploys, This has caused some problems:

  • double the number of candidates, and candidates with prefix pods/ and deployment.apps/, looks a little confused
  • two requests in one completion, slower

i wrote nu-complete kube deploys and pods, it's completed in two stages

  • first it will complete the deployment and add a suffix - when token not ends-with -
    • when ka or kl accepts an argument with suffix -, it'll be rewritten as $"deployment/($pod | str substring ..-1)"
  • if token ends-with -, it's considered unfinished pod and continues

    - update `kadm check` and `kadm renew`
    - refactor `nu-complete kube pods or deploys` to `nu-complete kube deploys and pods`

    in nushell#680, `nu-complete kube pods` changed to `pods or deploys`, This has caused some problems:
    - double the number of candidates, and candidates with prefix `pods/` and `deployment.apps/`, looks a little confused
    - two requests in one completion, slower

    considering `deployment` relative `pod` is not so common in `ka` or
    'kl', i wrote `nu-complete kube deploys and pods`, it's completed in two stages
    - first it will complete the `deployment` and add a suffix `-` when
      token not ends-with `-`
    - if token ends-with `-`, it's considered unfinished `pod` and
      complete the `pod`
    - when `ka` or `kl` accepts an argument with suffix `-`, it'll be rewritten as `$"deployment/($pod | str substring ..-1)"`
- remove unnecessary parentheses
- replace `spr` with `if` expression
- replace `sprb` with `with-flag`
@fj0r fj0r force-pushed the main branch 3 times, most recently from 03db897 to 015897e Compare December 1, 2023 09:03
@fdncred
Copy link
Collaborator

fdncred commented Dec 1, 2023

This with-flag custom command seems interesting. Does it seem to work better like this?

@fj0r
Copy link
Contributor Author

fj0r commented Dec 2, 2023

Yeah, at least it's name makes sense. it's not exactly same as the original spr, but it's okay for the current use case, and it's more common and simple.

@fdncred fdncred merged commit 82abb89 into nushell:main Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants