Skip to content

Docs issue#6#52

Merged
parisaelasticpath merged 4 commits intomainfrom
docs-Issue#6
Apr 5, 2022
Merged

Docs issue#6#52
parisaelasticpath merged 4 commits intomainfrom
docs-Issue#6

Conversation

@parisaelasticpath
Copy link
Copy Markdown
Contributor

docs command support #6

Comment thread cmd/docs.go
Comment on lines +15 to +34
if len(args) != 0 {
resource := resources.Resources[args[0]]
url := resource.Docs

switch runtime.GOOS {
case "linux":
exec.Command("xdg-open", url).Start()
case "windows":
exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
exec.Command("open", url).Start()
default:
fmt.Errorf("unsupported platform")
}
return nil
// return fmt.Errorf("This function is not implemented")

} else {
return fmt.Errorf("You must supply a resource type to the docs command")
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor this so that your and @mahsaelasticpath 's commands call a function to open a URL, instead of copying and pasting it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a separate file name "share", Done

Comment thread cmd/docs.go
RunE: func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("This function is not implemented")
if len(args) != 0 {
resource := resources.Resources[args[0]]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the resource doesn't exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done
returning error as below
return fmt.Errorf("You must supply a valid resource type to the docs command")"

@parisaelasticpath parisaelasticpath merged commit ae87f71 into main Apr 5, 2022
@parisaelasticpath parisaelasticpath deleted the docs-Issue#6 branch April 5, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants