lib/braid/commands/remove.rb in braid-1.1.9 vs lib/braid/commands/remove.rb in braid-1.1.10

- old
+ new

@@ -1,20 +1,33 @@ -# typed: true +# typed: strict module Braid module Commands class Remove < Command - def run(path, options = {}) - mirror = config.get!(path) + class Options < T::Struct + prop :keep, T::Boolean + end + sig {params(path: String, options: Options).void} + def initialize(path, options) + @path = path + @options = options + end + + private + + sig {void} + def run_internal + mirror = config.get!(@path) + with_reset_on_error do msg "Removing mirror from '#{mirror.path}'." git.rm_r(mirror.path) config.remove(mirror) add_config_file - if options[:keep] + if @options.keep msg "Not removing remote '#{mirror.remote}'" if verbose? elsif git.remote_url(mirror.remote) msg "Removed remote '#{mirror.path}'" if verbose? git.remote_rm mirror.remote else