Commit Graph

329 Commits

Author SHA1 Message Date
Chris Laprun
73c74946eb Replace RootCmd() by NewCmdOdo function and use it. 2018-11-29 13:58:30 +01:00
Girish Ramnani
4ab05f69c4 resolved golint errors for variable names and comments incorrectly written 2018-11-28 18:03:15 +05:30
Georgios Andrianakis
2d9ab2825a Fix panic when no args supplied to cli-doc (#1048)
Fixes: #1047
2018-11-27 15:23:56 +05:30
Chris Laprun
6d05c4ba9d Move commands to where they should be (#1002)
* Move main to cmd/odo.

* Refactor doc generation into one single command.

* Rename for consistency.

* Move commands to pkg/odo/cli.

* Export Add*Flag functions to prepare for move.

* Move validateName to pkg/odo/cli/util/validation.go.

* Move functions used by only one command to the command file.

* Renamed to storage_test since tests are storage-related.

* Move usage template to cmdutils.

* Use RootCmd() instead of var access.

* Move printComponentInfo back to cmdutils and expose.

* Move application to application package.

* Move component to component package. Move componentShortFlag also.
Not sure why it was on delete and not on component.

* Move commands to appropriate packages.

* Rename root to cli.

* Rename main to odo.

* Fix wrong reference to main file.

* Fix(?) generate-coverage.sh.

* Move root command name to cli.go.

* Move Add*Flag functions to genericclioptions/context_flags.
Move adding completion handler to package-specific functions
(duplication >_<)

* Move CmdUsageTemplate and PrintComponentInfo to odo/util package.

* Move VERSION and getLatestReleaseInfo to cli/version package.
Remove now empty cmdutils.

* Start using NewCmd* instead of init. Break import cycle. :)

* Rename client to cmdutils.

* Move to use NewCmd* pattern for all commands.

* Fix cross-compilation target.
2018-11-22 13:22:03 +05:30
Suraj Narwade
83cebd1a01 Added command auto completion for odo storage (#986)
Fixes #941
2018-11-21 19:58:48 +05:30
Mrinal Das
3d2076cfbd Added file completion support for update command (#1013) 2018-11-21 14:13:30 +05:30
Charlie Drage
82968cb05b 0.0.16 Release (#1018) 2018-11-20 15:28:01 -05:00
Syam.G.Krishnan
9bef06e0d2 fix #995 : change component selection logic in update cmd (#999)
change the component selection part to use context.Component()
2018-11-20 19:05:46 +05:30
girish ramnani
e364c3598c resolved bug in the way componentCmd was added FlagSet (#1000) 2018-11-16 12:39:47 -05:00
Georgios Andrianakis
87d30e7416 Add go completion for odo url delete (#980)
Fixes: #938
2018-11-16 11:56:08 +02:00
Chris Laprun
5e144c448a Fix broken tests. 2018-11-15 11:24:17 +01:00
Mrinal Das
80e299f8ea Added the project auto completion code (#959)
* Added the project auto completion code

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Added getUserTypedCommands function fro getting user typed entitites

Signed-off-by: mik-dass <mrinald7@gmail.com>
2018-11-15 10:34:16 +01:00
Charlie Drage
2f7ed49711 Release 0.0.15 (#972) 2018-11-13 12:55:09 -05:00
Tomas Kral
604b98b17d Use context in logout command 2018-11-13 17:34:15 +01:00
Tomas Kral
1ee505249e Merge pull request #699 from syamgk/logout
Add command odo logout
2018-11-13 17:05:04 +01:00
Chris Laprun
2e91e59bff Factor out creation of contextual information (project, application, component) to make it easier to manage and facilitate refactoring of commands (#949)
* Use constants for flag names.

* Introduce Context struct and use it to replace util.GetComponent

* Remove redundant break statements.

* Do not exit when attempting to access a possibly not defined flag.

* Fix improper logic.

* Add ComponentAllowingEmpty to make it more useful and use it.

* Start removing usage of util.GetAppName

* Remove unneeded check for error (no error can occur there).

* Deprecate GetAppName in favor of Context.Application.
Will need to use Context in completion infrastructure as well but this
will be part of a later PR.

* Remove unneeded (and invalid) GetOrCreateAppName function.

* Deprecate GetAndSetNamespace and remove it where possible.
Can't currently touch the completion handlers.

* Make completion handlers use Context and allow
them to access the current command.
This allows removal of GetAppName and GetAndSetNamespace.

* Replace GetOcClient function by genericclioptions.Client and ClientWithConnectionCheck

* Remove now unneeded global variables and GetOcClient function.

* Fix improper check if component flag has been set.

* Polish and add comments.

* Update FileCompletionHandler.

* Fix formatting.

* Fix AppCompletionHandler.

* Rename existsOrExit to be more explicit.

* Change error code.

* Replace todo by TODO.
2018-11-13 16:51:11 +01:00
syamgk
8a9aa1dbbc changed function according to refactoring 2018-11-13 17:51:10 +05:30
syamgk
9afe492c95 change help msg to be more specific and rename KubeConfig 2018-11-13 17:51:10 +05:30
syamgk
4a6e891a27 fix help msg 2018-11-13 17:51:10 +05:30
syamgk
1601209e8a move logout under utility + fix e2e test 2018-11-13 17:51:10 +05:30
syamgk
a2302a5cf2 fix error msg, add err check and unexport Conf 2018-11-13 17:51:10 +05:30
syamgk
ccf25a2947 rename logout cmd description 2018-11-13 17:48:40 +05:30
syamgk
48a65e41c0 Add command odo logout
- add func RunLogout in occlient
2018-11-13 17:48:40 +05:30
Tomas Kral
077441681b Merge pull request #826 from surajnarwade/login-trial
odo login
2018-11-13 12:53:15 +01:00
Georgios Andrianakis
0ee8c4ed77 Improve odo link support (#847)
* Improve odo link support

- Provide wait flag for secret to be present
- Improve error messages
- Provide detailed statuses for deployed services

Fixes: #846

* Polish
2018-11-13 15:30:04 +05:30
Suraj Narwade
71e9bffc8d odo login 2018-11-13 15:19:46 +05:30
Suraj Narwade
fdb2bad291 Added command completion for odo app commands (#934)
* `odo app describe`
* `odo app delete`
* `odo app set`
2018-11-12 13:18:53 +01:00
Mrinal Das
f79341f82e Added completion support for files and directories. (#962)
This completion handler is added to the create command for the local and binary flags.
Signed-off-by: mik-dass <mrinald7@gmail.com>
2018-11-12 10:42:10 +01:00
Suraj Narwade
3d79962665 Added --client flag to odo version (#935)
This PR adds `--client` flag to `odo version` command so that,
to check only client version, we dont need to talk to server.
(Similar to `kubectl`)

Usage:

```
odo version --client
```
2018-11-12 11:27:53 +02:00
Mrinal Das
16ec149a2f Adds a new line in odo app describe when there is no active application in project (#956) 2018-11-12 10:37:27 +02:00
Charlie Drage
b19f9b5d81 Correct link documentation (#958)
Corrects the link documentation with the correct examples (library /
component source FIRST and then the name..)
2018-11-09 10:47:17 -05:00
Georgios Andrianakis
294609258b Make link handling common across both components and services (#856)
This is done by making `link` always "inject" a secret into the
DeploymentConfig of the source component.
In the case of services, the secret is created indirectly via the
ServiceBinding.
In the case of components, the secret is created when when we create
the component. In such cases on secret is created per exposed port.

Fixes: #652
2018-11-07 12:56:55 -05:00
Georgios Andrianakis
f88af92935 Change version command to tolerate missing possible /version/openshift (#920)
This is done because a cluster created with "oc cluster up" can in some
cases (as is the case for OKD 3.11) the endpoint is missing completely
and we don't want the tool to fail in such cases (following the example
set by oc)

Fixes: #872
2018-11-07 14:36:28 +02:00
anmolbabu
59d3a4cd4c Incorporate @kadel suggestion
This commit makes pushlocal function a parameter to ease unit testing

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-11-01 20:11:59 +05:30
anmolbabu
81385dde93 Add unit tests and e2e for the watch command
1. WatchAndPush: The test for this function:
       i. Creates a temporary component source directory structure
      ii. Mocks implementation of PushLocal to only use compare the diff set against the expected ones
     iii. Creates, deletes and modifies some files and folders
      iv. Ignores some files and folders specified using regexp
       v. Also, stops the watch gracefully at the end of the tests using the newly added extChan channel.
2. e2e test for watch does the following:
	i. Uses the wildfly component local source for component creation
       ii. Spawns a go-routine to simulate file modifications to test watch
      iii. Starts execution of non-terminating watch command witha timeout and when test condition passes
	   before timeout, the command gracefully exits

fixes #770
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-11-01 20:11:59 +05:30
Tomas Kral
e17ea7741c Merge pull request #906 from cdrage/open-link
Open created url with --open
2018-11-01 15:05:50 +01:00
Charlie Drage
942818032a Open created url with --open
This function adds the --open parameter to `odo url create`.

This will open the created link on the user's default browser.

To test:

```sh
odo create nodejs
odo url create --open
```

Closes https://github.com/redhat-developer/odo/issues/905
2018-11-01 08:56:45 -04:00
Chris Laprun
f0e203fa83 Fix #913: fix completion handler key generation.
It should now work even the command hierarchy is not complete and the
code is also simpler. Win! :)
2018-10-31 22:53:32 +01:00
Chris Laprun
316da3e084 Fix #903: rewrite completion handler key generation to avoid collisions.
The previous implementation only used the command's name as key which
wasn't enough. This implementation requires the command hierarchy to be
resolved before the registration process as the key is generated by
walking back to the root command. The implementation will exit with an
error message if registration happens before the hierarchy is set.
2018-10-31 14:44:03 +01:00
Chris Laprun
f654db26fa Rename util2 to odoutil. 2018-10-31 11:05:46 +01:00
Chris Laprun
8ed9a67968 Move getAndSetNamespace, getAppName and getComponent to pkg/odo/util. 2018-10-31 11:05:46 +01:00
Chris Laprun
c87ef76fa0 Move completion handlers to completion package. 2018-10-31 11:05:46 +01:00
Chris Laprun
268cb77dc3 Remove old bash completion code. Update cli-reference. 2018-10-31 11:05:46 +01:00
Chris Laprun
e6c9c4c00c Extract completion handling into specific go package. 2018-10-31 11:05:46 +01:00
Chris Laprun
21144058cc Encapsulate internal implementation of handlers handling for extraction. 2018-10-31 11:05:46 +01:00
Chris Laprun
aa29bbf35e Move getOcClient and checkError to pkg/odo/util. 2018-10-31 11:05:46 +01:00
Y.Horie
ed29d715dc check application existence before confirmation #888 (#897)
* check application existtence before confirmation #888

* fix error message not exist apps #888
2018-10-31 11:44:08 +05:30
Georgios Andrianakis
627b823021 Enhance the odo service describe
A new struct ServicePlanParameter is introduced that contains
information about all parameters of a plan
The UI is also updated to show this information
(albeit in a non optimized way)

Fixes: #880
2018-10-30 18:19:11 +02:00
Syam.G.Krishnan
73173d5ac5 add config parameter to modify server connection check timeout (#757)
* fix #617 : add config parameter to change default timeout

add config parameter to modify server connection check timeout

* incorporated comments

* modify comment

* cleaned unwanted comments

* incorporated comments
2018-10-30 08:58:32 -04:00
Suraj Narwade
cb231889b6 Fixing service.go (#895)
This PR fixes small change which was missed in  https://github.com/redhat-developer/odo/pull/683 and  breaking master
2018-10-30 11:03:26 +01:00