Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1.  
  2. import Coreutils; using Coreutils;
  3. var version="1.0";
  4.  
  5. function void umount(var p)
  6. {
  7.  
  8. if(p is int)
  9. {
  10. Storage.mounts.each(){|mp|
  11.  
  12. if(mp.id==p)
  13. {
  14. print("Unmount: ");puts(mp.storagePath);
  15.  
  16. mp.unmount();
  17. break;
  18. }
  19. };
  20. }
  21. elsif(p is string)
  22. {
  23. Storage.mounts.each(){|mp|
  24.  
  25. if(mp.storagePath==p)
  26. {
  27. print("Unmount: ");puts(mp.storagePath);
  28. mp.unmount();
  29. }
  30. };
  31. }
  32. }
  33. export function void main(const array args)
  34. {
  35. //deep$ mount 'fs:storage/bin'
  36. //fs:storage/bin
  37.  
  38. if(args.empty)
  39. {
  40. Storage.mounts.each() { |mount_point| print(mount_point.id to string);print(" : ");puts(mount_point.storagePath);};
  41. return;
  42. }
  43.  
  44. var Args argum;
  45. argum.args=args;
  46. argum.setRules =
  47. {'i,id'=>'params,-1','p,path'=>'params,-1'};
  48.  
  49. argum.parse();
  50.  
  51. argum.args.each_with_index(){|a,i|
  52. if(a=="help")
  53. {
  54. Coreutils.putHelp();
  55. }
  56. elsif(a=="version")
  57. {
  58. puts(version);
  59. }
  60. elsif(a=='id')
  61. {
  62. argum.getParams(i).each(){|op| umount(op to int);};
  63.  
  64. }
  65. elsif(a=='path')
  66. {
  67. argum.getParams(i).each(){|op| umount(op);};
  68. }
  69. };
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement