FsShellCommands extends ConfigurationAware implements ExecutionProcessor { @CliCommand(value = PREFIX + "count", help = "Count the number of directories, files, bytes, quota, and remaining quota") public void count( @CliOption(key = { "quota" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with quta information") final boolean quota, @CliOption(key = { "path" }, mandatory = true, help = "path name") final String path) { List<String> argv = new ArrayList<String>(); argv.add("-count"); if(quota){ argv.add("-q"); } String[] fileNames = path.split(" "); argv.addAll(Arrays.asList(fileNames)); run(argv.toArray(new String[0])); }  @PostConstruct void init(); @Override ParseResult beforeInvocation(ParseResult invocationContext); @CliCommand(value = PREFIX + "ls", help = "List files in the directory") void ls(
			@CliOption(key = { "" }, mandatory = false, specifiedDefaultValue = ".", unspecifiedDefaultValue = ".", help = "directory to be listed") final String path,
			@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive); @CliCommand(value = PREFIX + "cat", help = "Copy source paths to stdout") void cat(@CliOption(key = { "" }, mandatory = true, specifiedDefaultValue = ".", unspecifiedDefaultValue = ".", help = "file name to be showed") final String path); @CliCommand(value = PREFIX + "chgrp", help = "Change group association of files") void chgrp(@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive,
			@CliOption(key = { "group" }, mandatory = true, help = "group name") final String group,
			@CliOption(key = { "" }, mandatory = true, help = "file name to be changed group") final String path); @CliCommand(value = PREFIX + "chown", help = "Change the owner of files") void chown(
			@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive,
			@CliOption(key = { "owner" }, mandatory = true, help = "owner name") final String owner,
			@CliOption(key = { "" }, mandatory = true, help = "file name to be changed group") final String path); @CliCommand(value = PREFIX + "chmod", help = "Change the permissions of files") void chmod(
			@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive,
			@CliOption(key = { "mode" }, mandatory = true, help = "permission mode") final String mode,
			@CliOption(key = { "" }, mandatory = true, help = "file name to be changed permissions") final String path); @CliCommand(value = PREFIX + "copyFromLocal", help = "Copy single src, or multiple srcs from local file system to the destination file system. Same as put") void copyFromLocal(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest); @CliCommand(value = PREFIX + "put", help = "Copy single src, or multiple srcs from local file system to the destination file system") void put(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest); @CliCommand(value = PREFIX + "moveFromLocal", help = "Similar to put command, except that the source localsrc is deleted after it's copied") void moveFromLocal(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest); @CliCommand(value = PREFIX + "copyToLocal", help = "Copy files to the local file system. Same as get") void copyToLocal(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest,
			@CliOption(key = { "ignoreCrc" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether ignore CRC") final boolean ignoreCrc,
			@CliOption(key = { "crc" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether copy CRC") final boolean crc); @CliCommand(value = PREFIX + "copyMergeToLocal", help = "Takes a source directory and a destination file as input and concatenates files in src into the destination local file") void copyMergeToLocal(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest,
			@CliOption(key = { "endline" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether add a newline character at the end of each file") final boolean endline); @CliCommand(value = PREFIX + "get", help = "Copy files to the local file system") void get(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest,
			@CliOption(key = { "ignoreCrc" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether ignore CRC") final boolean ignoreCrc,
			@CliOption(key = { "crc" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether copy CRC") final boolean crc); @CliCommand(value = PREFIX + "count", help = "Count the number of directories, files, bytes, quota, and remaining quota") void count(
			@CliOption(key = { "quota" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with quta information") final boolean quota,
			@CliOption(key = { "path" }, mandatory = true, help = "path name") final String path); @CliCommand(value = PREFIX + "cp", help = "Copy files from source to destination. This command allows multiple sources as well in which case the destination must be a directory") void cp(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest); @CliCommand(value = PREFIX + "mv", help = "Move source files to destination in the HDFS") void mv(
			@CliOption(key = { "from" }, mandatory = true, help = "source file names") final String source,
			@CliOption(key = { "to" }, mandatory = true, help = "destination path name") final String dest); @CliCommand(value = PREFIX + "du", help = "Displays sizes of files and directories contained in the given directory or the length of a file in case its just a file") void du(
			@CliOption(key = { "" }, mandatory = false, specifiedDefaultValue = ".", unspecifiedDefaultValue = ".", help = "directory to be listed") final String path,
			@CliOption(key = { "summary" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with summary") final boolean summary); @CliCommand(value = PREFIX + "expunge", help = "Empty the trash") void expunge(); @CliCommand(value = PREFIX + "mkdir", help = "Create a new directory") void mkdir(
			@CliOption(key = { "" }, mandatory = true, help = "directory name") final String dir); @CliCommand(value = PREFIX + "rm", help = "Remove files in the HDFS") void rm(
			@CliOption(key = { "" }, mandatory = false, specifiedDefaultValue = ".", unspecifiedDefaultValue = ".", help = "directory to be listed") final String path,
			@CliOption(key = { "skipTrash" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether skip trash") final boolean skipTrash,
			@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive); @CliCommand(value = PREFIX + "setrep", help = "Change the replication factor of a file") void setrep(
			@CliOption(key = { "path" }, mandatory = true, help = " path name") final String path,
			@CliOption(key = { "replica" }, mandatory = true, help = "source file names") final int replica,
			@CliOption(key = { "recursive" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether with recursion") final boolean recursive,
			@CliOption(key = { "waiting" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether wait for the replic number is eqal to the number") final boolean waiting); @CliCommand(value = PREFIX + "tail", help = "Display last kilobyte of the file to stdout") void tail(
			@CliOption(key = { "" }, mandatory = true, help = "file to be tailed") final String path,
			@CliOption(key = { "file" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "whether show content while file grow") final boolean file); @CliCommand(value = PREFIX + "text", help = "Take a source file and output the file in text format") void text(
			@CliOption(key = { "" }, mandatory = true, help = "file to be showed") final String path); @CliCommand(value = PREFIX + "touchz", help = "Create a file of zero length") void touchz(
			@CliOption(key = { "" }, mandatory = true, help = "file to be touched") final String path);  }
@Test public void testCount() { fsCmd.count(false, tmpFile); }