Skip to content

Refactor CLI default command to be mode modular and cleaner code #275

@bhouston

Description

@bhouston

The default command in the cli is quite messy code. I think we should take a lot of its logic and make reusable methods that are used by that command rather than the large mess of nested if tests.

As well this code logic (not verbatim but the same idea) is present in more than one part of the code base, it seems like it should be a single reusable function:

 const config = await loadConfig(
    getConfigFromArgv(argv as ArgumentsCamelCase<SharedOptions>),
  );

I don't like that the default command makes multiple loggers, there should just be done.

I think the check for upgrades could be done on all commands rather than just the default one - it just needs to check the config to see if it should happen or not. Thus we could move it out of just the default command.

Basically I feel that the default command and surrounding cli code has become messy and really hard to maintain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions