Skip to content

Commit

Permalink
open: clean up logic and improve description
Browse files Browse the repository at this point in the history
  • Loading branch information
Smarticles101 committed Oct 22, 2020
1 parent 764d72f commit 76cf131
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var openCmd = &cobra.Command{
Short: "Open an exercise on the website.",
Long: `Open the specified exercise to the solution page on the Exercism website.
Pass the path to the directory that contains the solution you want to see on the website.
Find local exercises by slug or team. You can also check for remote exercises.
Alternatively, you can pass a local exercise directory.
`,
RunE: func(cmd *cobra.Command, args []string) error {
cfg := config.NewConfig()
Expand Down Expand Up @@ -68,10 +69,11 @@ func runOpen(cfg config.Config, flags *pflag.FlagSet, args []string) error {
path = args[0]
}

if exerciseSlug == "" && path == "" {
return fmt.Errorf("must provide an --exercise slug or an exercise path")
}

if exerciseSlug == "" {
if path == "" {
return fmt.Errorf("must provide an --exercise slug or an exercise path")
}
// if no --exercise is given, use original functionality
metadata, err := workspace.NewExerciseMetadata(path)
if err != nil {
Expand Down

0 comments on commit 76cf131

Please sign in to comment.