Class: Command::Mkfs

Inherits:
Object
  • Object
show all
Defined in:
lib/diskman/commands/mkfs.rb

Instance Method Summary collapse

Instance Method Details

#get_listObject



3
4
5
6
7
# File 'lib/diskman/commands/mkfs.rb', line 3

def get_list
    Dir['/sbin/mkfs.*'].map do |path|
        path.gsub(%r[^/sbin/mkfs.], '')
    end.sort
end

#run(list: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/diskman/commands/mkfs.rb', line 9

def run(list: false)
    if list
        puts get_list
        return
    end

    device = RootDevice.choose
    device = device.choose_with_partitions

    fs = Chooser.new(get_list, item: 'filesystem').select
    cmd = device.get_mkfs_command(fs)

    puts "Filesystem: #{fs.yellow}"
    puts "Device:     #{device.to_s.yellow}"
    puts "Command:    #{cmd.yellow}"

    System.exec!(cmd)
end