Implement behavior to clean up numeric suffixes in exercise directories

Open
#699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
go
Domain
cli

Research direction

Start with the exercism doctor command and workspace.PotentialExercises(), then trace the download and submit commands. Done means suffixed exercise directories are grouped and interactively cleaned up, while download and submit reject suffixed directories with an error directing users to exercism doctor.

Written by the indexing model from the issue text.

Description

When we launched the v2 site, the CLI had some funky behavior that sometimes adds a numeric suffix to the exercise directory. This behavior is going away.

The exercism doctor command should clean any of these up.

We can rely on the workspace.PotentialExercises() functionality to do this, and then group them into each group of related exercises. E.g.

  • ruby/hello-world
  • ruby/hello-world-2
  • ruby/hello-world-3

These would all be in one group.

For each group where there are any exercises with a suffix we should have an interactive prompt. Something like:

Which one would you like to keep? Select your choice by typing the number.
1. hello-world
2. hello-world-2
3. hello-world-3
4. Skip this one. Do nothing and move on.

If they select one of the exercises (not skip), then:

  • delete all but the selected one
  • rename the selected one to remove the suffix (if it has one)

Additional error handling

In the download command we should bail with an error if trying to download to an exercise directory with a numeric suffix.

In the submit command we should bail with an error if trying to submit an exercise that is in a directory with a numeric suffix.

The error messages should suggest running exercism doctor.

Dominant language
Go
Stars
1.4k
Forks
363
Avg merge
6d 13h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from exercism/cli

All issues in exercism/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.