31 lines
680 B
Go
31 lines
680 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
var projectRunCmd = &cobra.Command{
|
||
|
Use: "run",
|
||
|
Short: "Run the project (e.g. go run .)",
|
||
|
Aliases: []string{"exec", "r"},
|
||
|
Long: projRunCmdLong,
|
||
|
Run: projectRunCmdRun,
|
||
|
}
|
||
|
|
||
|
func projectRunCmdRun(cmd *cobra.Command, args []string) {
|
||
|
project := fzfCwdOrSearchProjectAliases(searchStringFromArgs(args))
|
||
|
if project == nil {
|
||
|
plog.Fatal("No project selected, nothing to open")
|
||
|
}
|
||
|
|
||
|
plog.Info("Running Projet", plog.Args("lang", project.Language))
|
||
|
|
||
|
if project.Language == nil {
|
||
|
plog.Fatal("GitLab isn't sure what language this project is... can't run.")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
projectCmd.AddCommand(projectRunCmd)
|
||
|
}
|