At ChefConf, @therealpadams and I chatted about the CLI UX of habitat and came up with a list of 'smalls' that could help round off the sharp edges for new users. This list may ultimately need broken out if/when things get picked off, and these items might also be good candidates for the 'I'm new to Rust and want to contribute to Habitat core' crowd :)
Potential CLI UX improvements that we discussed were:
for hab pkg upload, when no specific package name is provided, default to uploading the most recent. Alternatively, we could use a flag to choose the most recent such as --latest. This saves the time of having to a) find your list of local builds and b) identify and copy the full name of the build you want to upload (which is most likely the most current anyhow).
provide a simple way to navigate to the directory of my latest build. For example, something like cd $latest (while in the studio) could take you directly to /hab/pkg/origin/name/version/release/... since typing that out is 馃樋 and as a new user that path is likely not obvious.
provide an easier way to see which packages I currently have installed. For example, something like hab pkg list would show everything currently installed in my studio.
building upon the notion of hab pkg list, I might want to remove specific packages that I no longer want to use/have replaced in my plan as I write and build from it. For example, something like hab pkg rm core/mysql or hab pkg uninstall core/mysql if, say, I switched to use a different db package.
on the topic of removing things in the studio, it would be handy to have a way to confidently clean my studio (especially when exiting and entering a new studio does not do the job). For example, something like hab studio clean could remove all builds and installed packages.
provide an easy way to see what is currently running. For example, something like hab svc list or hab sup running.
provide ample warning / prevent foot guns around the size of hab in your root partition. At a minimum, we should consider a recommendation in the docs or during hab setup that suggests you do something like run hab in its own partition. Further, we might add a step to hab setup that allows you to confirm a suggested max size or enter a max size for /hab (e.g. 10GB). Additionally, we could provide a warning message (upon enteirng hab studio?) letting you know that you are close to and/or exceeding this maximum... and circling back to an above item, we could propose you use a clean function if one exists to help manage this.
I especially like the list and remove options. There are a couple of these that I believe we already have:
hab studio rm will remove the studio including its packages.hab sup status will show what is running in the supervisorThe problem with has studio rm is that I have to exit the studio to invoke it. The idea with something like has studio clean is that I do not need to exit the studio, I just clean up the one I am already in.
hab sup status is tasty.
On note of $latest, I have always kept these in my .studiorc to make getting to things quicker:
lastbuilt() = $latest
function lastbuilt() {
echo $(grep pkg_artifact results/last_build.env | awk -F= '{print $2}')
}
function ilastbuilt() {
hab install results/$(lastbuilt)
}
function habupload() {
local hart=$1
hab pkg upload $hart
}
function habls() {
local pkg_ident=$1
local path=$2
ls -al $(hab pkg path $pkg_ident)/$path
}
function habcat() {
local pkg_ident=$1
local file=$2
cat $(hab pkg path $pkg_ident)/$file
}
function habcd() {
local pkg_ident=$1
local path=$2
cd $(hab pkg path $pkg_ident)/$path
}
function habvim() {
local pkg_ident=$1
local path=$2
vim $(hab pkg path $pkg_ident)/$path
}
function habldd() {
local pkg_ident=$1
local path=$2
ldd $(hab pkg path $pkg_ident)/$path
}
function habexec() {
local pkg_ident=$1
shift 1
local bin=$@
hab pkg exec $pkg_ident $bin
}
Perhaps a few of these helpers can be built into the studio.
Can we break these out into discrete issues? Otherwise we won't be able to completely close.
In the meantime, here was some quick thoughts from our triage session:
hab pkg upload: we probably want to better document the ./results/last_build.env file which contains all the metadata required to do something like this$latest: we probably should better document hab pkg path@fnichol I'd be happy to break them out, but I don't have a good grasp on which felt worthy of a new issue vs which have alternatives in place that just need better documentation. Of that list, which do you feel necessitate a new issue?
Most helpful comment
On note of
$latest, I have always kept these in my.studiorcto make getting to things quicker:lastbuilt()=$latestPerhaps a few of these helpers can be built into the studio.