addServiceRoleOptions function

  1. @visibleForTesting
void addServiceRoleOptions(
  1. ArgParser parser
)

Registers the union of the Hub and Node start options.

shell-path is the one name both roles declare (same default, same meaning modulo direction), and data-dir means something broader here than it does on hub start — the root holding credentials, identity and, for a Hub, the fleet data underneath. Both are registered exactly once, here: ArgParser throws on a duplicate name, and since ServiceCommand() is built inside buildRunner(), a duplicate would take down every command.

Implementation

@visibleForTesting
void addServiceRoleOptions(ArgParser parser) {
  parser
    ..addOption(
      'shell-path',
      defaultsTo: '/shell',
      help:
          'OmnyShell broker mount path (Hub: where it is served; Node: where '
          'the Hub serves it).',
    )
    ..addOption(
      'data-dir',
      help:
          'Directory the service keeps its state in: credentials and identity, '
          'and — for a Hub — the fleet data (nodes, audit, metrics, desired '
          'state, issued grants) under <dir>/hub. Defaults to ~/.omnyserver, '
          'or /var/lib/omnyserver under --system.',
    );
  addHubStartOptions(parser, includeShellPath: false, includeDataDir: false);
  addNodeStartOptions(parser, includeShellPath: false);
}