defs.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Rufs - Remote Union File System
  3. *
  4. * Copyright 2017 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the MIT
  7. * License, If a copy of the MIT License was not distributed with this
  8. * file, You can obtain one at https://opensource.org/licenses/MIT.
  9. */
  10. /*
  11. Package term contains a terminal implementation which can control Rufs trees.
  12. */
  13. package term
  14. /*
  15. cmdMap contains all available commands
  16. */
  17. var cmdMap = map[string]func(*TreeTerm, ...string) (string, error){
  18. "?": cmdHelp,
  19. "help": cmdHelp,
  20. "cd": cmdCd,
  21. "dir": cmdDir,
  22. "ll": cmdDir,
  23. "checksum": cmdChecksum,
  24. "tree": cmdTree,
  25. "branch": cmdBranch,
  26. "mount": cmdMount,
  27. "reset": cmdReset,
  28. "ping": cmdPing,
  29. "cat": cmdCat,
  30. "get": cmdGet,
  31. "put": cmdPut,
  32. "rm": cmdRm,
  33. "ren": cmdRen,
  34. "mkdir": cmdMkDir,
  35. "cp": cmdCp,
  36. "sync": cmdSync,
  37. "refresh": cmdRefresh,
  38. }
  39. var helpMap = map[string]string{
  40. "help [cmd]": "Show general or command specific help",
  41. "cd [path]": "Show or change the current directory",
  42. "dir [path] [glob]": "Show a directory listing",
  43. "checksum [path] [glob]": "Show a directory listing and file checksums",
  44. "tree [path] [glob]": "Show the listing of a directory and its subdirectories",
  45. "branch [branch name] [rpc] [fingerprint]": "List all known branches or add a new branch to the tree",
  46. "mount [path] [branch name] [ro]": "List all mount points or add a new mount point to the tree",
  47. "reset [mounts|brances]": "Remove all mounts or all mounts and all branches",
  48. "ping <branch name> [rpc]": "Ping a remote branch",
  49. "cat <file>": "Read and print the contents of a file",
  50. "get <src file> [dst local file]": "Retrieve a file and store it locally (in the current directory)",
  51. "put [src local file] [dst file]": "Read a local file and store it",
  52. "rm <file>": "Delete a file or directory (* all files; ** all files/recursive)",
  53. "ren <file> <newfile>": "Rename a file or directory",
  54. "mkdir <dir>": "Create a new directory",
  55. "cp <src file/dir> <dst dir>": "Copy a file or directory",
  56. "sync <src dir> <dst dir>": "Make sure dst has the same files and directories as src",
  57. "refresh": "Refreshes all known branches and reconnect if possible",
  58. }