Reference.from constructor

Reference.from(
  1. String input
)

Creates a Reference instance from a String input. The input string must start with a single character as specified via referencePrefix.

The tail is split the way a shell would, so the quoting an author wrote in the config survives: $deploy --message "hello world" forwards hello world as one argument.

Implementation

factory Reference.from(String input) {
  final paths = shellSplit(input.substring(1));

  final script = paths.isEmpty ? '' : paths.first;
  final extra = paths.skip(1).toList();

  return Reference(
    script: script.split(referenceNestingDelimiter).join(' '),
    extra: extra,
  );
}