addNodeStartOptions function

void addNodeStartOptions(
  1. ArgParser parser, {
  2. bool includeShellPath = true,
})

Adds the node start options to parser.

includeShellPath exists for the merged service parser — shell-path is the one option name both roles declare, so only one of the two helpers may register it.

Implementation

void addNodeStartOptions(ArgParser parser, {bool includeShellPath = true}) {
  parser
    ..addOption('hub', help: 'Hub WSS URL, e.g. wss://hub:8443.')
    ..addOption('id', help: 'Node id.')
    ..addOption('principal', defaultsTo: 'node-account', help: 'Principal.')
    ..addOption('token', help: 'Bearer token.')
    ..addOption('ca', help: 'Trusted CA certificate (PEM).')
    ..addFlag(
      'insecure',
      negatable: false,
      help: 'Accept any TLS certificate (dev only).',
    )
    ..addFlag(
      'with-shell',
      negatable: false,
      help: 'Also run an OmnyShell node, so the Hub can open shell sessions.',
    );
  if (includeShellPath) {
    parser.addOption(
      'shell-path',
      defaultsTo: '/shell',
      help: "Path of the Hub's OmnyShell broker (with --with-shell).",
    );
  }
  parser
    ..addFlag(
      'ship-logs',
      defaultsTo: true,
      help:
          "Send the agent's own log lines to the Hub, so `node logs` can read "
          'them without logging into the machine.',
    )
    ..addMultiOption(
      'label',
      help:
          'Node label "key=value" (repeatable), e.g. env=prod. Labels are how '
          'a fleet is addressed: they filter `nodes list` and select the '
          'targets of `formula run` and `preset apply`.',
    )
    ..addMultiOption(
      'shell-label',
      help:
          'OmnyShell node label "key=value" (repeatable), e.g. '
          'allow-roles=admin.',
    );
}