mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Add -p parameter to give custom project name
This commit is contained in:
parent
52e629b69a
commit
57d30172be
2 changed files with 9 additions and 4 deletions
8
main.go
8
main.go
|
|
@ -26,8 +26,9 @@ var (
|
|||
date string
|
||||
buildSource = "unknown"
|
||||
|
||||
configFlag = false
|
||||
debuggingFlag = false
|
||||
configFlag = false
|
||||
debuggingFlag = false
|
||||
projectName string = ""
|
||||
composeFiles []string
|
||||
)
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ func main() {
|
|||
flaggy.Bool(&configFlag, "c", "config", "Print the current default config")
|
||||
flaggy.Bool(&debuggingFlag, "d", "debug", "a boolean")
|
||||
flaggy.StringSlice(&composeFiles, "f", "file", "Specify alternate compose files")
|
||||
flaggy.String(&projectName, "p", "project", "Specify a custom project name")
|
||||
flaggy.SetVersion(info)
|
||||
|
||||
flaggy.Parse()
|
||||
|
|
@ -71,7 +73,7 @@ func main() {
|
|||
log.Fatal(err.Error())
|
||||
}
|
||||
|
||||
appConfig, err := config.NewAppConfig("lazydocker", version, commit, date, buildSource, debuggingFlag, composeFiles, projectDir)
|
||||
appConfig, err := config.NewAppConfig("lazydocker", version, commit, date, buildSource, debuggingFlag, composeFiles, projectDir, projectName)
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ type AppConfig struct {
|
|||
}
|
||||
|
||||
// NewAppConfig makes a new app config
|
||||
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool, composeFiles []string, projectDir string) (*AppConfig, error) {
|
||||
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool, composeFiles []string, projectDir string, projectName string) (*AppConfig, error) {
|
||||
configDir, err := findOrCreateConfigDir(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -502,6 +502,9 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
|||
if len(composeFiles) > 0 {
|
||||
userConfig.CommandTemplates.DockerCompose += " -f " + strings.Join(composeFiles, " -f ")
|
||||
}
|
||||
if len(projectName) > 0 {
|
||||
userConfig.CommandTemplates.DockerCompose += " -p " + projectName
|
||||
}
|
||||
|
||||
appConfig := &AppConfig{
|
||||
Name: name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue