Class FileCommands

  • All Implemented Interfaces:
    org.springframework.shell.core.CommandMarker, org.springframework.shell.core.ExecutionProcessor

    @Component
    public class FileCommands
    extends ShellCommands
    • Constructor Detail

      • FileCommands

        public FileCommands()
                     throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • available

        @CliAvailabilityIndicator({"ls","pwd","cd","cat"})
        public boolean available()
      • ls

        @CliCommand(value="ls",
                    help="Lists files and folders.")
        public void ls​(@CliOption(key={"","path","p"},help="Path")
                       java.lang.String path)
                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • pwd

        @CliCommand(value="pwd",
                    help="Print the absolute path of the current working directory.")
        public void pwd()
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • cd

        @CliCommand(value="cd",
                    help="Change the current directory to the specified path.")
        public void cd​(@CliOption(key={"","path","p"},specifiedDefaultValue="User\'s home directory")
                       java.lang.String path)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • mkdir

        @CliCommand(value="mkdir",
                    help="Create a directory at the specified path.")
        public void mkdir​(@CliOption(key={"","path","p"})
                          java.lang.String path)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • cat

        @CliCommand(value="cat",
                    help="Print the content of the specified file on the standard output")
        public void cat​(@CliOption(key={"","path","p"},mandatory=true,specifiedDefaultValue="File to print")
                        java.lang.String path)
                 throws java.io.IOException
        Throws:
        java.io.IOException