This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jason McCallister <jason@craftcms.com>
- Loading branch information
1 parent
0458831
commit b4e9a81
Showing
2 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.PHONY: install scripts | ||
|
||
VERSION ?= 1.0.0-RC.2 | ||
VERSION ?= 1.0.0-RC2 | ||
NITRO_DEFAULT_MACHINE ?= nitro-dev | ||
|
||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,52 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/craftcms/nitro/internal/config" | ||
"github.com/craftcms/nitro/internal/nitro" | ||
) | ||
|
||
const infoTemplate = `Nitro installed, ready for something incredible at %s. | ||
Add a project with "nitro add <directory>". | ||
Server Information | ||
------------------------- | ||
IP address: %s | ||
PHP version: %s | ||
Need help setting up Xdebug? | ||
https://github.com/craftcms/nitro/blob/master/XDEBUG.md | ||
Need help using Nitro? | ||
https://github.com/craftcms/nitro/blob/master/README.md` | ||
|
||
var infoCommand = &cobra.Command{ | ||
Use: "info", | ||
Short: "Show machine info", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
machine := flagMachineName | ||
runner := nitro.NewMultipassRunner("multipass") | ||
ip := nitro.IP(machine, runner) | ||
php := config.GetString("php", flagPhpVersion) | ||
|
||
infoAction, err := nitro.Info(machine) | ||
if err != nil { | ||
return err | ||
// check if the machine is running, if not start it | ||
if ip == "" { | ||
fmt.Println("The " + machine + " is not running...") | ||
if err := startCommand.RunE(cmd, args); err != nil { | ||
return err | ||
} | ||
|
||
// get the IP again | ||
ip = nitro.IP(machine, runner) | ||
} | ||
|
||
return nitro.Run(nitro.NewMultipassRunner("multipass"), []nitro.Action{*infoAction}) | ||
fmt.Println(fmt.Sprintf(infoTemplate, ip, ip, php)) | ||
fmt.Println("") | ||
|
||
return nil | ||
}, | ||
} |