ehharvey / lms-2024

3 stars 2 forks source link

Code quality / Refactoring #240

Open ehharvey opened 5 hours ago

ehharvey commented 5 hours ago
ehharvey commented 4 hours ago
    public string GetHelp()
    {
        return $"""
        Tag 

        Description:
        Tags are things applied to all other entities.
        This command managed the existence of tags and applies
        them to other entities (e.g., WorkItem Tags, etc.)

        Verbs:
        - create: {GetHelp(Verb.Create)}
        - list: {GetHelp(Verb.List)}
        - edit: {GetHelp(Verb.Edit)}
        - delete: {GetHelp(Verb.Delete)}
        """;
    }

    string GetHelp(Verb verb) {
        switch (verb) {
            case Verb.Create:
                return "Create a tag";
            case Verb.List:
                return "List currently created tags";
            case Verb.Edit:
                return "Edit the name of a tag";
            case Verb.Delete:
                return "Delete a tag";
            default:
                throw new ArgumentException("Unsupported Tag");
        }
    }

We should instead move all help text relating to a ver to GetHelp(Verb). Then we can iterate over the Valid Verbs in the generic GetHelp()