Skip to content

Commit

Permalink
Merge pull request #86 from Aijeyomah/update-name-flag
Browse files Browse the repository at this point in the history
remove 'n' from the name flag
  • Loading branch information
leecalcote authored Jan 8, 2025
2 parents 787c171 + e85764d commit 0b8a1ce
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
10 changes: 9 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ linters:

linters-settings:
gofmt:
simplify: true
simplify: true
issues:
exclude-dirs:
- '.*pkg/mod.*'
- '.*go/.*'
- '.*Cellar.*' # Skip Homebrew Go installation directory
- '.*libexec.*'
exclude-files:
- '.*toolchain@.*'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ print_home:


local.deploy: local.build ## Deploys locally built Helm plugin
@rm -rf ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot
@rm -rf ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot
@cp helm-images ${HOME}/Library/helm/plugins/helm-kanvas-snapshot/bin/helm-kanvas-snapshot


Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,19 @@ To install the Meshery Snapshot Helm Plugin, use the following steps:
Once the plugin is installed, you can generate a snapshot using either a packaged or unpackaged Helm chart.

```bash
helm helm-kanvas-snapshot -f <chart-URI> [-n <snapshot-name>] [-e <email>]
helm helm-kanvas-snapshot -f <chart-URI> [--name <snapshot-name>] [-e <email>]
```

- **`-f`**, **`--file`**: (required) path or URL to the Helm chart (required).
- **`-n`**, **`--name`**: (optional) name for the snapshot. If not provided, a name will be auto-generated based on the chart name.
- **`--name`**: (optional) name for the snapshot. If not provided, a name will be auto-generated based on the chart name.
- **`-e`, **`--email`**: (optional) email address to notify when snapshot is ready. If not provided, a link to the snapshot will be displayed in the terminal.

**Example**

To generate a snapshot for a Helm chart located at `https://meshery.io/charts/v0.8.0-meshery.tar.gz`, you can use:

```bash
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz -n meshery-chart
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz --name meshery-chart
```

## Contributing
Expand Down Expand Up @@ -128,7 +128,7 @@ helm plugin install kanvas-snapshot
Once the plugin is built, you can test it locally. For example, to generate a snapshot for a Helm chart, run the following command:

```bash
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz -n meshery-chart
helm helm-kanvas-snapshot -f https://meshery.io/charts/v0.8.0-meshery.tar.gz --name meshery-chart
```

This command will trigger the snapshot generation process. If everything is set up correctly, you should see a visual snapshot URL or receive the snapshot via email, depending on the options you specified.
Expand Down
17 changes: 9 additions & 8 deletions cmd/kanvas-snapshot/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ var generateKanvasSnapshotCmd = &cobra.Command{
Example usage:
helm kanvas-snapshot -n nginx-helm -f https://meshery.github.io/meshery.io/charts/meshery-v0.7.109.tgz -e [email protected]
helm kanvas-snapshot -f https://meshery.github.io/meshery.io/charts/meshery-v0.7.109.tgz -e [email protected] --name nginx-helm
Flags:
-f, --file string URI to Helm chart (required)
-n, --name string (optional name for the Meshery design
-f, --file string URI to Helm chart (required)
-e, --email string email address to notify when snapshot is ready (required)
--name string (optional) name for the Meshery design
-h Help for Helm Kanvas Snapshot plugin`,

RunE: func(_ *cobra.Command, _ []string) error {
Expand All @@ -66,9 +66,8 @@ var generateKanvasSnapshotCmd = &cobra.Command{
handleError(errors.ErrCreatingMesheryDesign(err))
}

assetLocation := fmt.Sprintf("https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/%s.png", designID)
assetLocation := fmt.Sprintf("https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/helm-plugin-assets/%s.png", designID)

// Generate Snapshot
err = GenerateSnapshot(designID, assetLocation, WorkflowAccessToken)
if err != nil {
handleError(errors.ErrGeneratingSnapshot(err))
Expand Down Expand Up @@ -243,14 +242,16 @@ func Main(providerToken, mesheryCloudAPIBaseURL, mesheryAPIBaseURL, workflowAcce
MesheryAPIBaseURL = mesheryAPIBaseURL
WorkflowAccessToken = workflowAccessToken
generateKanvasSnapshotCmd.Flags().StringVarP(&chartURI, "file", "f", "", "URI to Helm chart (required)")
generateKanvasSnapshotCmd.Flags().StringVarP(&designName, "design-name", "n", "", "Optional name for the Meshery design")
generateKanvasSnapshotCmd.Flags().StringVar(&designName, "name", "", "Optional name for the Meshery design")
generateKanvasSnapshotCmd.Flags().StringVarP(&email, "email", "e", "", "Optional email to associate with the Meshery design")

_ = generateKanvasSnapshotCmd.MarkFlagRequired("file")

if err := generateKanvasSnapshotCmd.Execute(); err != nil {
Log.Error(err)
os.Exit(1)
errors.ErrHTTPPostRequest(err)
generateKanvasSnapshotCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
return nil
})
}
}

Expand Down
Binary file removed cmd/kanvas-snapshot/kanvas-snapshot
Binary file not shown.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/meshery/helm-kanvas-snapshot

go 1.21.8
go 1.23

toolchain go1.23.4

require (
Expand Down

0 comments on commit 0b8a1ce

Please sign in to comment.