-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extensions): add execute command (#225)
* feat(extensions): add execute command this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: remember to add error Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: without empty line Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: adds github remote registry index (#226) * feat: with github registry Signed-off-by: Kasper J. Hermansen <[email protected]> * fix: shuttle extensions Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: can download private files Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: remove fluff Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: fix review comments Signed-off-by: Kasper J. Hermansen <[email protected]> * feat: it needs to implement the functions Signed-off-by: Kasper J. Hermansen <[email protected]> --------- Signed-off-by: Kasper J. Hermansen <[email protected]> --------- Signed-off-by: Kasper J. Hermansen <[email protected]>
- Loading branch information
Showing
13 changed files
with
592 additions
and
16 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
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,44 @@ | ||
package extensions | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
type shuttleExtensionsRegistry struct { | ||
GitHub *string `json:"github" yaml:"github"` | ||
} | ||
|
||
type shuttleExtensionProviderGitHubRelease struct { | ||
Owner string `json:"owner" yaml:"owner"` | ||
Repo string `json:"repo" yaml:"repo"` | ||
} | ||
|
||
type shuttleExtensionsProvider struct { | ||
GitHubRelease *shuttleExtensionProviderGitHubRelease `json:"github-release" yaml:"github-release"` | ||
} | ||
|
||
type shuttleExtensionsFile struct { | ||
Name string `json:"name" yaml:"name"` | ||
Description string `json:"description" yaml:"description"` | ||
|
||
Provider shuttleExtensionsProvider `json:"provider" yaml:"provider"` | ||
Registry shuttleExtensionsRegistry `json:"registry" yaml:"registry"` | ||
} | ||
|
||
func getExtensionsFile(_ context.Context) (*shuttleExtensionsFile, error) { | ||
templateFileContent, err := os.ReadFile("shuttle.template.yaml") | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to find shuttle.template.yaml: %w", err) | ||
} | ||
|
||
var templateFile shuttleExtensionsFile | ||
if err := yaml.Unmarshal(templateFileContent, &templateFile); err != nil { | ||
return nil, fmt.Errorf("failed to parse shuttle.template.yaml: %w", err) | ||
} | ||
|
||
return &templateFile, nil | ||
} |
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
Oops, something went wrong.