forked from gravitational/gamma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from vincenthsh/fix-autocomplete-ignore-non-ac…
…tion fix: Autocomplete fatal error on non-action libraries
- Loading branch information
Showing
7 changed files
with
85 additions
and
7 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
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
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
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package list | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/jedib0t/go-pretty/v6/text" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/gravitational/gamma/internal/logger" | ||
"github.com/gravitational/gamma/internal/utils" | ||
"github.com/gravitational/gamma/internal/workspace" | ||
) | ||
|
||
var workingDirectory string | ||
var workspaceManifest string | ||
|
||
var Command = &cobra.Command{ | ||
Use: "list", | ||
Short: "List all the actions in the monorepo", | ||
Long: `List all the actions in the monorepo.`, | ||
Run: func(_ *cobra.Command, _ []string) { | ||
started := time.Now() | ||
|
||
workingDirectory = utils.FetchWorkingDirectory(workingDirectory) | ||
|
||
nd, err := utils.NormalizeDirectories(workingDirectory) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
|
||
ws := workspace.New(workspace.Properties{ | ||
WorkingDirectory: nd[0], | ||
WorkspaceManifest: workspaceManifest, | ||
}) | ||
|
||
logger.Info("collecting actions") | ||
|
||
actions, err := ws.CollectActions(true) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
|
||
if len(actions) == 0 { | ||
logger.Fatal("could not find any actions") | ||
} | ||
|
||
logger.Info("found actions:") | ||
for _, action := range actions { | ||
logger.Infof(" ✅ %s (%s/%s)", action.Name(), action.Owner(), action.RepoName()) | ||
} | ||
|
||
took := time.Since(started) | ||
|
||
bold := text.Colors{text.FgWhite, text.Bold} | ||
logger.Success(bold.Sprintf("done in %.2fs", took.Seconds())) | ||
}, | ||
} | ||
|
||
func init() { | ||
Command.Flags().StringVarP(&workingDirectory, "directory", "d", "the current working directory", "directory containing the monorepo of actions") | ||
Command.Flags().StringVarP(&workspaceManifest, "workspace", "w", "gamma-workspace.yml", "workspace manifest for non-javascript actions") | ||
} |
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
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
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