Skip to content

Comments

Some fixes in parsing flags and add example with cobra usage#18

Merged
name212 merged 5 commits intomainfrom
cobra-examples
Feb 10, 2026
Merged

Some fixes in parsing flags and add example with cobra usage#18
name212 merged 5 commits intomainfrom
cobra-examples

Conversation

@name212
Copy link
Member

@name212 name212 commented Feb 9, 2026

Fix flags parsing:

  • copy of flag set is not deep, thus we have problems is call multiple parsers with InitFlags. Now we are using internal flag set for parsing flags in parser, but add another fake flag set to passed flag set into InitFlags, for output help and prevent unknown flags error during parsing paret flags
  • filepath.Abs does not resolve ~, we were fixed it

Add parser to Flags and ExtractConfig method, it improve dx because we can init flags during initialize command and pass only Flags to handler

If ssh connection config set ForceUseSSHAgent force no init new agent in cli-ssh

Also add check that hosts were set in DefaultSSHProvider

AskPassword add new line after prompt. We were fix it.

Add example with working library with cobra packages.

Some fixes in README

Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>
Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>
Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>
Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>
@name212 name212 added test/no-integration Skip integration testing and removed test/no-integration Skip integration testing labels Feb 10, 2026
Signed-off-by: Nikolay Mitrofanov <nikolay.mitrofanov@flant.com>
@name212 name212 changed the title Cobra examples Some fixes in parsing flags and add example with cobra usage Feb 10, 2026
@name212 name212 merged commit 3f60072 into main Feb 10, 2026
4 checks passed
@name212 name212 deleted the cobra-examples branch February 10, 2026 11:42
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.

1 participant