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)
- {
- print("Unmount: ");puts(mp.storagePath);
- mp.unmount();
- break;
- }
- };
- }
- elsif(p is string)
- {
- Storage.mounts.each(){|mp|
- if(mp.storagePath==p)
- {
- print("Unmount: ");puts(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| print(mount_point.id to string);print(" : ");puts(mount_point.storagePath);};
- return;
- }
- var Args argum;
- argum.args=args;
- argum.setRules =
- {'i,id'=>'params,-1','p,path'=>'params,-1'};
- argum.parse();
- argum.args.each_with_index(){|a,i|
- if(a=="help")
- {
- Coreutils.putHelp();
- }
- elsif(a=="version")
- {
- puts(version);
- }
- elsif(a=='id')
- {
- argum.getParams(i).each(){|op| umount(op to int);};
- }
- elsif(a=='path')
- {
- argum.getParams(i).each(){|op| umount(op);};
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement