diskman 1.1.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fc1b38621654bc6c54e2c341508f7a34bad56edea11e3d6a1430fb386aa7998
4
- data.tar.gz: ef7d21e5d8fd39f346e755fd8cc961c38d0b0f90fbd1a8a8326faacd5021ce39
3
+ metadata.gz: 18597e51e4108425ef54932ac7cbefd61f4262f6b1173e1e26dfd9ac7fa767e5
4
+ data.tar.gz: 4577c2c02e173a2aa3a57d0a60e72cea27f2a762bded6a241127fd1f3919c711
5
5
  SHA512:
6
- metadata.gz: 1633d95b48a889716644ec065f124add986f10eaa11ed8386b4c64cf354bcf0a909231e00d727637ff6f2821fe1282cf7f2e37a7ce648c3bfe58224c86ac298d
7
- data.tar.gz: 6e3d1a87a326e762cef359c67ba782f87a63f8f8f658b6dadbb21f3bf6ad2c13e1db6aaf550759384f6ba699f7deb5f0422ff1982ac68aff04709fc05c26301f
6
+ metadata.gz: e1fceab5cc522dfd98eced047c20524dc5882137b262e1779c048a5af8a2874166b32adef79034c896cf281a890cebe451f23507dbe3274bb80d5bb25933c563
7
+ data.tar.gz: a1e580ed8aa3d5fcc18c761d548767165bf461e35f09a10ea1bfdadd233e90131663138cc764b641f74e1cee1002002144632285ba1b38eb6cdf1d95ad8fe295
data/bin/diskman CHANGED
@@ -12,6 +12,9 @@ Params = Struct.new(
12
12
  :fdisk,
13
13
  :mkfs,
14
14
  :file,
15
+ :choose,
16
+ :device,
17
+ :partition,
15
18
  keyword_init: true,
16
19
  )
17
20
 
@@ -33,6 +36,9 @@ class Main
33
36
  fdisk: @opts['fdisk'],
34
37
  mkfs: @opts['mkfs'],
35
38
  file: @opts['<file>'],
39
+ choose: @opts['choose'],
40
+ device: @opts['device'],
41
+ partition: @opts['partition'],
36
42
  )
37
43
  end
38
44
 
@@ -50,6 +56,10 @@ class Main
50
56
  Command::Clone.new.run(file: params.file)
51
57
  elsif params.fdisk
52
58
  Command::Fdisk.new.run
59
+ elsif params.choose && params.device
60
+ Command::ChooseDevice.new.run
61
+ elsif params.choose && params.partition
62
+ Command::ChoosePartition.new.run
53
63
  end
54
64
  rescue Interrupt # rubocop:disable Lint/SuppressedException
55
65
  end
@@ -63,6 +73,7 @@ usage = <<~EOF
63
73
  #{PROGRAM_NAME} clone <file>
64
74
  #{PROGRAM_NAME} fdisk
65
75
  #{PROGRAM_NAME} mkfs [--list]
76
+ #{PROGRAM_NAME} choose ( device | partition )
66
77
  #{PROGRAM_NAME} ( --version | --help )
67
78
 
68
79
  Options:
@@ -17,37 +17,37 @@ module Diskman
17
17
 
18
18
  def select
19
19
  if @items.length == 0
20
- puts 'No %s found'.yellow % @plural
20
+ $stderr.puts 'No %s found'.yellow % @plural
21
21
  raise Interrupt
22
22
  end
23
23
 
24
24
  if @items.length == 1
25
- puts 'Found the following %s.' % label
25
+ $stderr.puts 'Found the following %s.' % label
26
26
  else
27
- puts 'Choose from the following %s.' % @plural
27
+ $stderr.puts 'Choose from the following %s.' % @plural
28
28
  end
29
29
 
30
- puts
30
+ $stderr.puts
31
31
 
32
32
  @items.each_with_index do |device, i|
33
- puts '%6d. %s' % [i + 1, device]
33
+ $stderr.puts '%5d. %s' % [i + 1, device]
34
34
  end
35
35
 
36
- puts
36
+ $stderr.puts
37
37
 
38
38
  if @items.length == 1
39
- puts 'Press enter to select it.'
39
+ $stderr.puts 'Press enter to select it.'
40
40
  $stdin.gets
41
41
  return @items.first
42
42
  end
43
43
 
44
- puts 'Enter your selection.'
45
- puts
46
- print '> '
44
+ $stderr.puts 'Enter your selection.'
45
+ $stderr.puts
46
+ $stderr.print '> '
47
47
 
48
48
  selection = $stdin.gets.chomp
49
49
 
50
- puts
50
+ $stderr.puts
51
51
 
52
52
  if selection.length == 0
53
53
  raise Interrupt
@@ -56,7 +56,7 @@ module Diskman
56
56
  selection = selection.to_i
57
57
 
58
58
  if selection <= 0 || selection > @items.length
59
- puts 'Invalid selection'.red
59
+ $stderr.puts 'Invalid selection'.red
60
60
  raise Interrupt
61
61
  end
62
62
 
@@ -0,0 +1,7 @@
1
+ module Command
2
+ class ChooseDevice
3
+ def run
4
+ puts RootDevice.choose.path
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Command
2
+ class ChoosePartition
3
+ def run
4
+ puts RootDevice.choose.choose_with_partitions.path
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Diskman
2
- VERSION = '1.1.0'
2
+ VERSION = '1.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diskman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - crdx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -52,48 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '13.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '13.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.8'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.8'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.21.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.21.0
97
55
  description:
98
56
  email:
99
57
  executables:
@@ -104,6 +62,8 @@ files:
104
62
  - bin/diskman
105
63
  - lib/diskman.rb
106
64
  - lib/diskman/chooser.rb
65
+ - lib/diskman/commands/choose_device.rb
66
+ - lib/diskman/commands/choose_partition.rb
107
67
  - lib/diskman/commands/clone.rb
108
68
  - lib/diskman/commands/fdisk.rb
109
69
  - lib/diskman/commands/mkfs.rb