Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split commands namespace #21

Merged
merged 1 commit into from
Aug 6, 2019
Merged

Split commands namespace #21

merged 1 commit into from
Aug 6, 2019

Conversation

rap1ds
Copy link
Member

@rap1ds rap1ds commented Aug 6, 2019

Built on top of #19

This commits splits the commands namespace to the following namespaces:

  • command-defs: Namespace that contains the CLI commands definitions and pointers to handler functions. This namespace needs to require all command handler namespalces
  • command-util: Namespace for util function for accessing and traversing the command definitions data structure
  • command-exec: Namespace for executing a command handler after the CLI arguments have been parsed
  • command-spec: Namespace for command specs.

The split was needed to resolve cyclic dependencies that happen easily because a help command handler is referenced in the command definitions structure, but the help handler itself needs to be aware of the command definitions structure in order to render the help.

The dependency graph is now following:

  • core depends on:
    • args-parse depends on:
      • command-spec
    • command-defs depedns on:
      • ...all command handlers
    • command-exec

@rap1ds rap1ds changed the title Split cmd ns Split commands namespace Aug 6, 2019
@rap1ds rap1ds requested a review from kpuputti August 6, 2019 06:41
@rap1ds rap1ds added the Pending review Pending review label Aug 6, 2019
@rap1ds rap1ds mentioned this pull request Aug 6, 2019
This commits splits the commands namespace to the following namespaces:

- command-defs: Namespace that contains the CLI commands definitions and pointers to handler functions. This namespace needs to require all command handler namespalces
- command-util: Namespace for util function for accessing and traversing the command definitions data structure
- command-exec: Namespace for executing a command handler after the CLI arguments have been parsed
- command-spec: Namespace for command specs.

The split was needed to resolve cyclic dependencies that happen easily because a help command handler is referenced in the command definitions structure, but the help handler itself needs to be aware of the command definitions structure in order to render the help.

The dependency graph is now following:

- core depends on:
  - args-parse depends on:
    - command-spec
  - command-defs depedns on:
    - ...all command handlers
  - command-exec
@kpuputti kpuputti removed the Pending review Pending review label Aug 6, 2019
@rap1ds rap1ds merged commit 1fa1e0e into master Aug 6, 2019
@rap1ds rap1ds deleted the split-cmd-ns branch August 6, 2019 11:48
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.

None yet

2 participants