Bug 1263947

Summary: [origin_userinterface_542]CLI doesn’t show any suggestion for some commands
Product: OKD Reporter: Wei Sun <wsun>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Wei Sun <wsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, mmccomas, wjiang
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-23 21:16:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wei Sun 2015-09-17 07:17:58 UTC
Description of problem:
For some commands,CLI doesn't give any suggestion.

Version-Release number of selected component (if applicable):
oc v1.0.6-62-gf74feb9
kubernetes v1.1.0-alpha.0-1605-g44c91b1
devenv_fedora_2355

How reproducible:
Always

Steps to Reproduce:
1.For rollback command
$ oc roll -h
Error: unknown command "roll" for "oc"
Run 'oc --help' for usage.
$ oc back -h
Error: unknown command "back" for "oc"
Run 'oc --help' for usage.
$ oc rback -h
Error: unknown command "rback" for "oc"
Run 'oc --help' for usage.

2.For new-app command
$ oc app -h
Error: unknown command "app" for "oc"
Run 'oc --help' for usage.

3.For some related to build commands
$ oc builds -h
Error: unknown command "builds" for "oc"
Run 'oc --help' for usage.
$ oc build -h
Error: unknown command "build" for "oc"
Run 'oc --help' for usage.

4.For deploy command
$ oc deployment -h
Error: unknown command "deployment" for "oc"
Run 'oc --help' for usage.
$ oc build -h
Error: unknown command "build" for "oc"
Run 'oc --help' for usage.

5.For image command
$ oc image
Error: unknown command "image" for "oc"
Run 'oc --help' for usage.

6.For annotate command
$ oc anot
Error: unknown command "anot" for "oc"
Run 'oc --help' for usage.


Actual results:
No any suggestion from CLI

Expected results:
Give some suggestion commands

Additional info:

Comment 1 Fabiano Franz 2015-09-28 15:07:34 UTC
There's a PR opened for Cobra, waiting for it to get merged so that we can bump it in OpenShift and get this fixed.

https://github.com/spf13/cobra/pull/163

Comment 2 Fabiano Franz 2015-09-30 00:31:38 UTC
Fixed in https://github.com/openshift/origin/pull/4859

Notice that not all ideas listed were implemented. We have to take care to not be too much aggressive in the suggestions. So "back", "rback" and "anot" where not implemented. The rules to suggest a similar command are basically these:

1. Levenshtein with a minimum distance of 2 (case insensitive);
2. Prefix match (so that, for example, we suggest "new-app" and "new-project" when the user tries "oc new");
3. A few explicit suggestions (for example, suggest "delete" when the user tries "oc remove", suggestions for "build", "builds", "deployment", "image", "app" and a couple others).

Comment 3 weiwei jiang 2015-09-30 09:00:34 UTC
Checked with devenv-fedora_2430, and the issue has been fixed.