Class: TLDR::ArgvReconstructor

Inherits:
Object
  • Object
show all
Defined in:
lib/tldr/argv_reconstructor.rb

Instance Method Summary collapse

Instance Method Details

#reconstruct(config, exclude:, ensure_args:, exclude_dotfile_matches:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tldr/argv_reconstructor.rb', line 3

def reconstruct config, exclude:, ensure_args:, exclude_dotfile_matches:
  argv = to_cli_argv(
    config,
    CONFLAGS.keys - exclude - [
      (:seed unless config.seed_set_intentionally),
      :watch,
      :i_am_being_watched
    ],
    exclude_dotfile_matches:
  )

  ensure_args.each do |arg|
    argv << arg unless argv.include?(arg)
  end

  argv.join(" ")
end

#reconstruct_single_path_args(config, path, exclude_dotfile_matches:) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/tldr/argv_reconstructor.rb', line 21

def reconstruct_single_path_args config, path, exclude_dotfile_matches:
  argv = to_cli_argv(config, CONFLAGS.keys - [
    :seed, :parallel, :names, :fail_fast, :paths, :prepend_paths,
    :no_prepend, :exclude_paths, :watch, :i_am_being_watched
  ], exclude_dotfile_matches:)

  (argv + [stringify(:paths, path)]).join(" ")
end