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

Auto complete function images for eval command #2449

Merged
merged 1 commit into from
Aug 16, 2021

Conversation

phanimarupaka
Copy link
Contributor

@phanimarupaka phanimarupaka commented Aug 13, 2021

This PR improves the discoverability of functions by providing tab completion for function images in the catalog available at https://catalog.kpt.dev/ (https://catalog.kpt.dev/catalog.json). Latest version for the image is suggested.

$ kpt fn eval -i [tab]
apply-setters:v0.1          fix:v0.2                    list-setters:v0.1           set-labels:v0.1             starlark:v0.2             
create-setters:v0.1         gatekeeper:v0.2             search-replace:v0.2         set-namespace:v0.1          upsert-resource:v0.1      
ensure-name-substring:v0.1  kubeval:v0.1                set-annotations:v0.1        set-project-id:v0.1 
$ kpt fn doc -i [tab]
apply-setters:v0.1          fix:v0.2                    list-setters:v0.1           set-labels:v0.1             starlark:v0.2             
create-setters:v0.1         gatekeeper:v0.2             search-replace:v0.2         set-namespace:v0.1          upsert-resource:v0.1      
ensure-name-substring:v0.1  kubeval:v0.1                set-annotations:v0.1        set-project-id:v0.1 

cc @Pitta @mikebz @grmoon

@Pitta
Copy link

Pitta commented Aug 13, 2021

excitement intensifies

@mikebz
Copy link
Contributor

mikebz commented Aug 14, 2021

LGTM, thanks for adding the test.

@mengqiy is the spec for the catalog JSON defined somewhere? Could be interesting for @natasha41575 and @yuwenma to examine eventually and figure out how to build in similar functionality into kustomize.

@bgrant0607 was interested in auto complete for functions, but I am not sure if there was an issue for it.

@mikebz
Copy link
Contributor

mikebz commented Aug 14, 2021

found the relevant issue and comments: #2344
fn doc issue by @frankfarzan #2009

@phanimarupaka phanimarupaka linked an issue Aug 16, 2021 that may be closed by this pull request
1 task
@phanimarupaka phanimarupaka removed a link to an issue Aug 16, 2021
1 task
@phanimarupaka phanimarupaka linked an issue Aug 16, 2021 that may be closed by this pull request
@phanimarupaka phanimarupaka merged commit 651aa79 into kptdev:main Aug 16, 2021
for fnName, fnInfo := range jsonData {
var latestVersion string
for version := range fnInfo {
if latestVersion < version {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use https://pkg.go.dev/golang.org/x/mod/semver for the comparison.

@mengqiy
Copy link
Contributor

mengqiy commented Sep 3, 2021

is the spec for the catalog JSON defined somewhere?

It is defined in go/kpt-fn-metadata. It is used in the site generation script: https://github.com/GoogleContainerTools/kpt-functions-catalog/blob/master/scripts/generate_catalog/generate_catalog.go#L74-L98

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.

Tab completion to list functions for eval and doc commands
6 participants