diff --git a/cmd/provision.go b/cmd/provision.go index 6ee61b2..6b7a4c2 100644 --- a/cmd/provision.go +++ b/cmd/provision.go @@ -16,7 +16,8 @@ import ( var Provision wisski_distillery.Command = pv{} type pv struct { - PHPVersion string `short:"p" long:"php" description:"specific php version to use for instance. Should be one of '8.0', '8.1'."` + PHPVersion string `short:"p" long:"php" description:"specific php version to use for instance. See 'provision --list-php-versions' for available versions. "` + ListPHPVersions bool `long:"list-php-versions" description:"List available php versions"` IIPServer bool `short:"i" long:"iip-server" description:"enable iip-server inside this instance"` OPCacheDevelopment bool `short:"o" long:"opcache-devel" description:"Include opcache development configuration"` Flavor string `short:"f" long:"flavor" description:"Use specific flavor. Use '--list-flavors' to list flavors. "` @@ -33,7 +34,7 @@ var errMissingSlug = exit.Error{ } func (pv pv) AfterParse() error { - if !pv.ListFlavors && pv.Positionals.Slug == "" { + if !pv.ListFlavors && !pv.ListPHPVersions && pv.Positionals.Slug == "" { return errMissingSlug } return nil @@ -60,6 +61,9 @@ func (p pv) Run(context wisski_distillery.Context) error { if p.ListFlavors { return p.listFlavors(context) } + if p.ListPHPVersions { + return p.listPHPVersions(context) + } instance, err := context.Environment.Provision().Provision(context.Stderr, context.Context, provision.Flags{ Slug: p.Positionals.Slug, @@ -90,3 +94,14 @@ func (pv) listFlavors(context wisski_distillery.Context) error { encoder.Encode(manager.Profiles()) return nil } + +func (pv) listPHPVersions(context wisski_distillery.Context) error { + for _, v := range models.KnownPHPVersions() { + if v == models.DefaultPHPVersion { + context.Printf("%s (default)\n", v) + } else { + context.Println(v) + } + } + return nil +} diff --git a/cmd/rebuild.go b/cmd/rebuild.go index cf2ba2a..27676a9 100644 --- a/cmd/rebuild.go +++ b/cmd/rebuild.go @@ -19,7 +19,7 @@ type rebuild struct { Parallel int `short:"a" long:"parallel" description:"run on (at most) this many instances in parallel. 0 for no limit." default:"1"` System bool `short:"s" long:"system-update" description:"Update the system configuration according to other flags"` - PHPVersion string `short:"p" long:"php" description:"update to specific php version to use for instance. Should be one of '8.0', '8.1'."` + PHPVersion string `short:"p" long:"php" description:"update to specific php version to use for instance. See 'provision --list-php-versions' for available versions. "` IIPServer bool `short:"i" long:"iip-server" description:"enable iip-server inside this instance"` OPCacheDevelopment bool `short:"o" long:"opcache-devel" description:"Include opcache development configuration"` Flavor string `short:"f" long:"flavor" description:"Use specific flavor. Use 'provision --list-flavors' to list flavors. "` diff --git a/internal/models/instances_system.go b/internal/models/instances_system.go index 8812c22..de72cf0 100644 --- a/internal/models/instances_system.go +++ b/internal/models/instances_system.go @@ -25,7 +25,7 @@ func (system System) OpCacheMode() string { } var ( - phpVersions = []string{"8.0", "8.1", "8.2"} + phpVersions = []string{"8.1", "8.2", "8.3"} phpVersionMap = (func() map[string]struct{} { m := make(map[string]struct{}, len(phpVersions)) for _, v := range phpVersions {