Class: Organisir::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/organisir/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/organisir/cli.rb', line 7

def self.exit_on_failure?
  true
end

Instance Method Details



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/organisir/cli.rb', line 67

def clean_symlinks
  if options[:commit]
    say "Preparing to remove all symlinks in 5 seconds. Cancel the command by pressing Ctrl-C"
    sleep(5)
  else
    say "clean_symlinks command always runs in non-commit mode. Use --commit true to remove symlinks.", :red
  end
  Organisir::Commands::CleanSymlinks.new(options[:source], Dir.pwd, options[:commit], options[:all]).clean
  say "Process completed"
rescue Interrupt
  say "Exiting organisir...", :green
end

#moveObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/organisir/cli.rb', line 16

def move
  if options[:commit]
    say "Preparing to move files in 5 seconds. Cancel the command by pressing Ctrl-C"
    sleep(5)
  else
    say "move command always runs in non-commit mode. Use --commit true to permanently move files.", :red
  end
  Organisir::Commands::MoveFiles.new(options[:source], options[:destination], Dir.pwd, options[:commit]).move
  say "Process completed"
rescue Interrupt
  say "Exiting organisir...", :green
end


50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/organisir/cli.rb', line 50

def multi_symlink
  if options[:commit]
    say "Preparing to symlink files in 5 seconds. Cancel the command by pressing Ctrl-C"
    sleep(5)
  else
    say "multi_symlink command always runs in non-commit mode. Use --commit true to symlink files.", :red
  end
  Organisir::Commands::MultiSymlinkFiles.new(options[:source], options[:destination], Dir.pwd, options[:commit]).link
  say "Process completed"
rescue Interrupt
  say "Exiting organisir...", :green
end


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/organisir/cli.rb', line 32

def symlink
  if options[:commit]
    say "Preparing to symlink files in 5 seconds. Cancel the command by pressing Ctrl-C"
    sleep(5)
  else
    say "symlink command always runs in non-commit mode. Use --commit true to symlink files.", :red
  end
  Organisir::Commands::SymlinkFiles.new(options[:source], Dir.pwd, options[:commit]).link
  say "Process completed"
rescue Interrupt
  say "Exiting organisir...", :green
end