8000 Add a command/flag to get active profile · Issue #1663 · minishift/minishift · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add a command/flag to get active profile #1663

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

Open
jorgemoralespou opened this issue Nov 5, 2017 · 15 comments
Open

Add a command/flag to get active profile #1663

jorgemoralespou opened this issue Nov 5, 2017 · 15 comments

Comments

@jorgemoralespou
Copy link
Contributor

I would like a command to get current active profile, so I can embed that in PS1 indicating me what's the current minishift profile. It's safer when executing actions.

Example:

minishift profile list --active

My prompt then can be easily expanded to show the profile name, and the context name:

[istio][istio --> developer@192.168.64.8:443/default]
[jmorales:~/repositories … /workshopper-content.git] master ± 
@kowen-rh
Copy link
Contributor
kowen-rh commented Nov 5, 2017

minishift profile list highlights the active profile in its output by appending "(active)". awk can be used to get the name of the active profile:

minishift profile list | awk '/\(active\)/ { print $2 }'

This is what I've used for scripting some basic interactions with Minishift.

minishift status also displays the name of the active profile, but may take some time to return if the VM is currently running. minishift profile list is consistently fast, so I prefer using it for scripting.

Personally, I like the composability of this.

@jorgemoralespou
Copy link
Contributor Author
8000

I like to have an option that consistently works on any OS and that's the fastest possible option.

@gbraad
Copy link
Member
gbraad commented Nov 5, 2017

I had originally placed the active profile on the first line for #1592, followed by a sorted list, as this would be easier to extract with other commands without having to check for active per se. However, this was removed in #1633. Adding a flag to force to only return the active profile, or a new command? I am not sure... Maybe, we can review this again, just let us know.

@jorgemoralespou
Copy link
Contributor Author
jorgemoralespou commented Nov 5, 2017 via email

@gbraad
Copy link
Member
gbraad commented Nov 5, 2017

We kind of have a solution... but just wondering how to tackle this in a nicer way, as a new flag sounds like overkill, but also understandable for scripting purpose.

8000

@jorgemoralespou
Copy link
Contributor Author
jorgemoralespou commented Nov 5, 2017 via email

@gbraad
Copy link
Member
gbraad commented Nov 5, 2017 via email

@hferentschik
Copy link
Member

I think adding a flag is the best option. Needing to have to work with sed/awk/grep is awkward. I don't think we new command is needed though.

@jorgemoralespou
Copy link
Contributor Author
jorgemoralespou commented Nov 5, 2017 via email

@LalatenduMohanty
Copy link
Member

Adding a flag --active to minishift profile list command works for me.

@LalatenduMohanty LalatenduMohanty self-assigned this Nov 10, 2017
@LalatenduMohanty LalatenduMohanty modified the milestone: v1.10.0 Nov 12, 2017
@LalatenduMohanty
Copy link
Member
LalatenduMohanty commented Nov 12, 2017

@jorgemoralespou @minishift/minishift-dev The issue is, to keep consistency with profile list we need to show the status of the active profile also in the output e.g.

 $minishift profile list --active
- minishift	Running

But I do not think @jorgemoralespou looking for that. He just need the active profile name. Any suggestion?

Here is how it will look like if we just print the profile name for minishift profile list --active

 $minishift profile list --active
 minishift
$minishift profile list
- bar		Does Not Exist
- bar2		Does Not Exist
- foo		Does Not Exist
- minishift	Running		(Active)
- test		Does Not Exist

Does it look fine to you?

8000
LalatenduMohanty added a commit to LalatenduMohanty/minishift that referenced this issue Nov 12, 2017
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@gbraad
Copy link
Member
gbraad commented Nov 13, 2017 via email

@brgnepal
Copy link
Contributor

Also, thing from script use case where one want to get active profile.

$ minishift profile list --active
minishift

but

 $minishift profile list --active
- minishift	Running

will create a problem.

May be

$ minishift profile --active
minishift

is the right place.

minishift status --profilename is definitely not the right place as it's context is totally changed. I mean user can't even guess we can get active profile from status command.

@gbraad
Copy link
Member
gbraad commented Nov 13, 2017

minishift status --profilename is definitely not the right place as it's context is totally changed. I mean user can't even guess we can get active profile from status command.

Then the user should also learn this, as we current have several information given there

minishift profile --active

This sounds not OK either. profile is just a resource (as subcommand), and there is no verb or action given with --active on that resource. For instance, m hostfolder add, m config set, m profiles set, all act on a resource.

@jorgemoralespou
Copy link
Contributor Author
jorgemoralespou commented Nov 13, 2017 via email

@stale stale bot added the status/stale label Jan 12, 2018
@minishift minishift deleted a comment from stale bot Jan 12, 2018
@agajdosi agajdosi added this to the Need To Be Planned milestone Sep 25, 2018
@LalatenduMohanty LalatenduMohanty removed their assignment May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
0