Skip to content

Honor global flags in all DevPod CLI sub-commands#161

Merged
skevetter merged 2 commits intoskevetter:mainfrom
dubinsky:do-not-ignore-global-flags
Dec 29, 2025
Merged

Honor global flags in all DevPod CLI sub-commands#161
skevetter merged 2 commits intoskevetter:mainfrom
dubinsky:do-not-ignore-global-flags

Conversation

@dubinsky
Copy link

@dubinsky dubinsky commented Dec 26, 2025

Currently, some of the DevPod CLI sub-commands do not honor global flags --context and --provider.

For instance:

$ devpod context create box
$ devpod ide use intellij --context default

sets the default ide on the 'box' context and not on the 'default' context, as can be verified with

$ devpod ide list
$ devpod context use default
$ devpod ide list

which is wrong ;)

The fix seems to be to move a '*' from the structure creation to the structure declaration, the way most of the sub-commands do it.

I have only a vague idea of what this all means, this being the first Go code I ever touched, but it does bring up C(++) memories from the last millennium...

I applied this adjustment to all the 13 commands that seem to have misplaced that crucial '*':

  • context create/delete/list/set-options/use
  • ide list/options/set-options/use
  • provider list/list-available/set-options/use

It is not clear to me how this was not detected earlier ;)

Please review!

@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch 4 times, most recently from c2c1c6b to b4f02d9 Compare December 26, 2025 02:54
@skevetter
Copy link
Owner

Thanks for submitting this.

Would you add the missing contexts when loading the config and tests? Reference my supplemental commits in #162

devPodConfig, err := config.LoadConfig(cmd.Context, cmd.Provider)

@dubinsky
Copy link
Author

dubinsky commented Dec 26, 2025

Thanks for submitting this.

My pleasure!

Would you add the missing contexts when loading the config and tests? Reference my supplemental commits in #162

I think that when creating/manipulating/using a context, with the context to be operated on supplied as a command line parameter, --context option should be ignored - as it is now. So, no on the 8144f66.
(Actually, I do not think the behaviour will be affected either way, but the mind boggles.)

Tests are amazing! Thank you so much for adding them!! Yes on 9f1f04e.

@dubinsky
Copy link
Author

Reference my supplemental commits in #162

Note: #162 is missing a change https://github.com/skevetter/devpod/pull/161/files#diff-d4945abb538db295c4697ad1aecc02ae2c8a6a10ef40f8b5e727081870307f71L22 (see explanation in the updated #161 description).

@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch 4 times, most recently from 09ace65 to 26cda45 Compare December 26, 2025 05:31
@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch from 26cda45 to 13514a1 Compare December 26, 2025 06:43
@skevetter
Copy link
Owner

Looks good. Would you add the integration test file?

@dubinsky
Copy link
Author

dubinsky commented Dec 26, 2025 via email

@skevetter
Copy link
Owner

I do not know how to add your commit

Don't worry about attribution/signature. To keep it simple, create the files on your development branch, commit the changes, and then push here.

@dubinsky
Copy link
Author

dubinsky commented Dec 26, 2025 via email

@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch from 13514a1 to 7825ef2 Compare December 28, 2025 23:51
@dubinsky
Copy link
Author

@skevetter - it is done

@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch from 7825ef2 to a5c5ba5 Compare December 29, 2025 00:54
Currently, some of the DevPod CLI sub-commands do not honor global flags `--context` and `--provider`.

For instance:
```shell
$ devpod context create box
$ devpod ide use intellij --context default
```
sets the default ide on the 'box' context and not on the 'default' context, as can be verified with

```shell
$ devpod ide list
$ devpod context use default
$ devpod ide list
```
which is wrong ;)

The fix seems to be to move a '*' from the structure creation to the structure declaration, the way most of the sub-commands do it.

I have only a vague idea of what this all means, this being the first Go code I ever touched, but it does bring up C(++) memories from the last millennium...

I applied this adjustment to all the 13 commands that seem to have misplaced that crucial '*':
- context create/delete/list/set-options/use
- ide list/options/set-options/use
- provider list/list-available/set-options/use

It is not clear to me how this was not detected earlier ;)

Please review!

Signed-off-by: Leonid Dubinsky <dub@podval.org>
Signed-off-by: Leonid Dubinsky <dub@podval.org>
@dubinsky dubinsky force-pushed the do-not-ignore-global-flags branch from a5c5ba5 to ffc293d Compare December 29, 2025 03:14
@skevetter skevetter merged commit fefeb57 into skevetter:main Dec 29, 2025
43 of 47 checks passed
@dubinsky
Copy link
Author

Thanks!

@dubinsky dubinsky deleted the do-not-ignore-global-flags branch December 31, 2025 21:12
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.

2 participants