Show Project Directory in Status Panel - #88
Conversation
In the future, it may be worth trying to compute this from ComposeFiles.
| } | ||
|
|
||
| gui.handleStatusSelect(gui.g, v) | ||
| gui.handleProjectSelect(gui.g, v) |
There was a problem hiding this comment.
Error return value of gui.handleProjectSelect is not checked (from errcheck)
| } | ||
|
|
||
| gui.handleStatusSelect(gui.g, v) | ||
| gui.handleProjectSelect(gui.g, v) |
There was a problem hiding this comment.
Error return value of gui.handleProjectSelect is not checked (from errcheck)
|
Please also adjust this line: lazydocker/scripts/generate_cheatsheet.go Line 29 in 572ff63 |
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 23.61% 23.68% +0.07%
==========================================
Files 13 13
Lines 1080 1081 +1
==========================================
+ Hits 255 256 +1
Misses 813 813
Partials 12 12
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 23.61% 23.68% +0.07%
==========================================
Files 13 13
Lines 1080 1081 +1
==========================================
+ Hits 255 256 +1
Misses 813 813
Partials 12 12
Continue to review full report at Codecov.
|
|
This would arguably be more correct if it preferred to use the "com.docker.compose.project" label... docker inspect --format='{{json .Config.Labels }}' $OBJECT_ID{
"com.docker.compose.config-hash":"fa59a5b47221e5a6a9b4d4182709755a0079ae2b4b634f59c44108a6dd57d081",
"com.docker.compose.container-number":"1",
"com.docker.compose.oneoff":"False",
"com.docker.compose.project":"project-name",
"com.docker.compose.service":"anonymous-service",
"com.docker.compose.version":"1.23.2"
}I don't know how often anyone actually customizes the project name, though... |
|
@pvande coincidentally, my work does haha. I'm not sure what the best approach is here. Is there a way to check if the project name hasn't been custom-set, and if so just revert to using the initial approach? |
|
@jesseduffield Awesome! As near as I can tell, the only way to get the project name back out of docker-compose is through the container labels. That's theoretically easy enough, though it introduces a strange cross-panel dependency (the Status/Project Panel now needs the list of Services). I'll see if I can get a PoC together quickly. |
| func (gui *Gui) getProjectContexts() []string { | ||
| if gui.DockerCommand.InDockerComposeProject { | ||
| return []string{"logs", "credits", "config"} | ||
| return []string{"logs", "config", "credits"} |
|
LGTM. One last thing though, given that we will likely have a bit of free horizontal space in the project panel, I wonder if we should add in brackets the docker-compose command from the config. That way, if people start lazydocker like That way they have even more context about what they're seeing. What are your thoughts on that? |
|
@jesseduffield I'm not opposed to surfacing the While we will have some space after the project name, even the simple example you gave is 62 characters long. At my desk, on my 4K monitor, that would probably fit just fine, but when I'm out on my laptop, my entire terminal width is commonly between 110 and 230 characters. That doesn't really leave enough space to show any meaningful amount of that command. It might be better to put that information on a second line in the project panel (space is still an issue, but less so), or in a tab under the project panel (perhaps fleshing the |
|
I agree. We can have another look at that after this is merged. As for this PR, it LGTM. Anything else you needed to do before we merge it? |
|
Anything further I might contribute fits just as easily in a new PR. Merge away! 🙂 |
|
thanks again :) |
As per this discussion, this puts the current working directory name into the Status Panel area. As related changes, this PR also moves the "lazydocker" project name down to the information area, and renames the Status Panel to the "Project Panel" (which seemed a natural consequence).