Miki Tebeka avatar Miki Tebeka committed 2dd5d77

rm

Comments (0)

Files changed (1)

webhdfs/__main__.py

     fs.put(args.src, args.dest, args.overwrite, args.blocksize,
            args.replication, args.mode, args.buffersize)
 
+def append(args):
+    if not isfile(args.src):
+        raise WebHDFSError('{} is not a file'.format(args.src))
+
+    fs.append(args.src, args.dest, args.buffersize)
+
+def mkdir(args):
+    fs.mkdir(args.path, args.mode)
+
+def mv(args):
+    fs.rename(args.src, args.dest)
+
+def rm(args):
+    fs.delete(args.path, args.recursive)
+
 def main(argv=None):
     global fs
     import sys
     put_parser.add_argument('-m', '--mode', type=lambda v: int(v, 8))
     put_parser.set_defaults(func=put)
 
+    append_parser = subs.add_parser('append')
+    append_parser.add_argument('src')
+    append_parser.add_argument('dest')
+    append_parser.add_argument('-b', '--buffersize', type=int, default=0)
+    append_parser.set_defaults(func=append)
+
+    mkdir_parser = subs.add_parser('mkdir')
+    mkdir_parser.add_argument('path')
+    mkdir_parser.add_argument('-m', '--mode', type=lambda v: int(v, 8))
+    mkdir_parser.set_defaults(func=mkdir)
+
+    mv_parser = subs.add_parser('mv')
+    mv_parser.add_argument('src')
+    mv_parser.add_argument('dest')
+    mv_parser.set_defaults(func=mv)
+
+    rm_parser = subs.add_parser('rm')
+    rm_parser.add_argument('path')
+    rm_parser.add_argument('-r', '--recursive', action='store_true',
+                           default=False)
+    rm_parser.set_defaults(func=rm)
 
     args = parser.parse_args(argv[1:])
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.