mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
Add support for -f flag
- If passed, passes to docker-compose as -f flag - Supports multiple docker-compose files
This commit is contained in:
parent
24264b35e6
commit
2bbdb9bf6e
2 changed files with 10 additions and 2 deletions
4
main.go
4
main.go
|
|
@ -23,6 +23,7 @@ var (
|
|||
|
||||
configFlag = false
|
||||
debuggingFlag = false
|
||||
composeFiles []string
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -33,6 +34,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.SetVersion(fmt.Sprintf("commit=%s, build date=%s, build source=%s, version=%s, os=%s, arch=%s\n", commit, date, buildSource, version, runtime.GOOS, runtime.GOARCH))
|
||||
|
||||
flaggy.Parse()
|
||||
|
|
@ -44,7 +46,7 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
appConfig, err := config.NewAppConfig("lazydocker", version, commit, date, buildSource, debuggingFlag)
|
||||
appConfig, err := config.NewAppConfig("lazydocker", version, commit, date, buildSource, debuggingFlag, composeFiles)
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
yaml "github.com/jesseduffield/yaml"
|
||||
|
|
@ -364,7 +365,7 @@ type AppConfig struct {
|
|||
}
|
||||
|
||||
// NewAppConfig makes a new app config
|
||||
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool) (*AppConfig, error) {
|
||||
func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool, composeFiles []string) (*AppConfig, error) {
|
||||
configDir, err := findOrCreateConfigDir(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -375,6 +376,11 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Pass compose files as individual -f flags to docker-compose
|
||||
if len(composeFiles) > 0 {
|
||||
userConfig.CommandTemplates.DockerCompose += " -f " + strings.Join(composeFiles, " -f ")
|
||||
}
|
||||
|
||||
appConfig := &AppConfig{
|
||||
Name: name,
|
||||
Version: version,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue