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

Add --context support #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add --context support #1

wants to merge 1 commit into from

Conversation

levrik
Copy link

@levrik levrik commented Feb 15, 2022

No description provided.

@@ -8,7 +8,7 @@ describe() {
help() {
echo -e "
Usage:
forward [-n namespace] host [sport:]dport
forward [--context context] [-n namespace] host [sport:]dport
Copy link
Owner

Choose a reason for hiding this comment

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

Let's keep this code consistent and use short options. I would suggest -c context here.

Copy link
Author

@levrik levrik Feb 15, 2022

Choose a reason for hiding this comment

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

Just wanted to be in line with other built-in kubectl commands here. There's just --context available.

Copy link
Owner

Choose a reason for hiding this comment

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

I understand, nevertheless using short options is cleaner here imho. We already do it for the namespace which is also supported natively by the kubectl. So, Iwould either:

  • change the context to just c to stay consistent with the current style,
  • or remove it completely in order to allow users to pass any kubectl built-in options, but without creating an explicits support for them here. In this scenario I would leave a note in readme to let users know they could find these options with the kubectl options.

Copy link
Author

@levrik levrik Feb 15, 2022

Choose a reason for hiding this comment

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

I see. But it's a bit different with --namespace as kubectl also supports -n as alias for it while -c isn't an alias for --context but is used to specify a config file.
The latter probably would be the approach here but I don't have time to work on this right now.

Copy link
Owner

Choose a reason for hiding this comment

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

Sure, no worries, there is no rush, feel free to come back to it when you have more time.

Copy link
Author

Choose a reason for hiding this comment

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

I'll keep using my fork for now.

case "$opt" in
h)
describe
help
;;
n) namespace="$OPTARG"
;;
-)
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above, let's keep it consistent and simplify by using short option.

@ljakimczuk
Copy link
Owner

@levrik direction is good, I have minor comments though

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