file-manipulation.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <title>SlideScript API: File manipulation ~ The Lazy Language</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7. <meta name="description" content="SlideScript API and Documentation section - SlideScript is a micro stripting language with the intent to give the world an effective shell like experience with the ability to use a sloppy syntax! SlideScript can do simple every day shell tasks like manipulating and working with files, and directories, piping, variable support, and backquoting, with a bit of spice like: built-in md5, and encoder / decoder, webserver, networking functions, tar and compression functions, PLUS MORE!" />
  8. <link href="../style.css" rel="stylesheet" type="text/css" />
  9. </head>
  10. <body>
  11. <table><tr><td>
  12. <div class="header">
  13. <img src="../sslogo.png" class="logoimg" title="SlideScript logo" alt="SlideScript" />
  14. </div>
  15. </td></tr><tr><td>
  16. <div class="menu"><!--
  17. --><a href="../index.html">Home</a><!--
  18. --><a href="index.html">Documentation</a><!--
  19. --><a href="https://notabug.org/Pentium44/slidescript">Git</a><!--
  20. --></div>
  21. </td></tr></table>
  22. <div class="container">
  23. <p>If you're following through the API documentation, chapter by chapter,
  24. then you have a good idea of the foundation of the language in terms
  25. of it's structure. Now for some features of SlideScript. File manipulation
  26. is definitely something that can be tackled without a doubt. A selection
  27. of functions within SlideScript that are file related are: isfile, isdir,
  28. showdir (ls), showpath (pwd), move (mv), delete, chdir (cd), read, write,
  29. and cat.<br /><br />
  30. To be honest, how could SlideScript be shell like without having the
  31. functionality of all the system utilities. Here's the kicker, everything
  32. is built-in to the core of SlideScript, making it extremely versatile and
  33. super simple! No dependency on other software!
  34. <pre><code>
  35. #!/usr/bin/slidescript
  36. # File manipulation examples
  37. # showdir: list directories/files in current directory.
  38. # argument count: 0
  39. # returns: file list.
  40. showdir
  41. ls # alias
  42. # showpath: show current working directory location (alias pwd).
  43. # argument count: 0
  44. # returns: working directory path
  45. showpath
  46. pwd # alias
  47. # chdir: Change directory
  48. # argument count: 1, "path" ex: "docs/"; "/home/user"
  49. # returns: No return
  50. chdir "docs/"
  51. showpath # Show return of change
  52. # backdir: Back a directory / to parent directory (same as chdir "..")
  53. # argument count: 0
  54. # returns: No return
  55. backdir
  56. # isdir / isfile: Return true or false (0 or 1) on file / directory find.
  57. # argument count: 1, "file/path" ex: "docs/README.txt"
  58. # returns: true / false
  59. isfile "docs/README.txt" # returns: true
  60. isdir "docs/" # returns: true
  61. isfile "docs/" # returns: false
  62. # move: move file / rename file based on arguments.
  63. # argument count: 2, "original" "new file name/location", ex: "docs/" "documents/"
  64. # returns: no return
  65. move "docs" "documents" # renamed docs -> documents
  66. # delete: delete file (non-recursive)
  67. # argument count: 1, "filename", ex: "docs/README.txt"
  68. # return: no return
  69. delete "docs/README.txt" # deletes README.txt inside docs/
  70. # read: read contents of file given to function
  71. # argument count: 1, "file", ex: "docs/README.txt"
  72. # return: contents of file
  73. read "docs/README.txt" # Returns contents of "README.txt"
  74. # write: write contents to file.
  75. # argument count: 2, "filename" "contents", ex: "test.txt" "Hello world!"
  76. # return: no return
  77. write "test.txt" "Hello world!"
  78. # cat: catenate file with given contents
  79. # argument count: 2, "file" "contents", ex: "test.txt" "I'm back!"
  80. # return: no return
  81. cat "test.txt" "I'm back!" # catenates "I'm back!" to the end of the original test.txt "Hello world!"
  82. # Ending file contents of "test.txt":
  83. # Hello world!
  84. # I'm back!
  85. </code></pre>
  86. </p>
  87. <h3>IRC server</h3>
  88. <p>
  89. Still need help? Want to report a bug? Join us!<br /><br />
  90. IP/Port: cddo.cc/1337<br />
  91. Main hang channel: <b>#theroot</b><br />
  92. FreeBox channel: <b>#freebox</b><br />
  93. FreonLinux channel: <b>#freonlinux</b>
  94. </p>
  95. </div>
  96. <div class="footer">
  97. &copy; Chris Dorman, 2021 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode">CC BY-NC-SA 4.0</a> - Software GPLv2 licensed<br />
  98. <p>
  99. Powered by:<br />
  100. <a href="https://freedns.afraid.org/">
  101. <img style="width:100px;" src="https://freedns.afraid.org/images/freedns_crop.png" />
  102. </a>
  103. <a href="https://letsencrypt.org/">
  104. <img style="width: 100px;" src="https://letsencrypt.org/images/le-logo-wide.png" />
  105. </a>
  106. <a href="http://jigsaw.w3.org/css-validator/check/referer">
  107. <img style="border:0;width:80px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" />
  108. </a>
  109. </p>
  110. </div>
  111. </body>
  112. </html>