Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Coreutils; using Coreutils;
- var version="1.0";
- function void umount(var p)
- {
- if(p is int)
- {
- Storage.mounts.each(){|mp|
- if(mp.id==p)
- {
- puts("Unmount: "+mp.storagePath);
- mp.unmount();
- break;
- }
- };
- }
- elsif(p is string)
- {
- Storage.mounts.each(){|mp|
- if(mp.storagePath==p)
- {
- puts("Unmount: "+mp.storagePath);
- mp.unmount();
- }
- };
- }
- }
- export function void main(const array args)
- {
- //deep$ mount 'fs:storage/bin'
- //fs:storage/bin
- if(args.empty)
- {
- Storage.mounts.each() { |mount_point| puts(mount_point.id to string+" : "+mount_point.storagePath);};
- return;
- }
- var Args argum;
- argum.args=args;
- argum.setRules =
- {'i,id'=>'value,ignore','s,storage'=>'value,ignore'};
- argum.parse();
- argum.args.each_with_index(){|a,i|
- if(a=="help")
- {
- Coreutils.putHelp();
- }
- elsif(a=="version")
- {
- puts(version);
- }
- elsif(a=='id')
- {
- umount(argum.getValue(i) to int);
- }
- elsif(a=='storage')
- {
- umount(argum.getValue(i));
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement