Advertisement
Guest User

Untitled

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