class Command::Mkfs

Public Instance Methods

get_list() click to toggle source
# 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) click to toggle source
# 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