Module io.jooby.cli
Package io.jooby.cli

Interface CliContext


public interface CliContext
Provides an execution context for application commands as well as utility methods for read and writing to the console.
Since:
2.0.6
  • Method Details

    • exit

      void exit(int code)
      Exit application.
      Parameters:
      code - Exit code.
    • writeTemplate

      void writeTemplate(@NonNull String template, @NonNull Object model, @NonNull Path file) throws IOException
      Look for the given template and dump/write to the file.
      Parameters:
      template - Template name.
      model - Template data.
      file - Output file.
      Throws:
      IOException - If something goes wrong.
    • copyResource

      void copyResource(@NonNull String source, @NonNull Path dest) throws IOException
      Copy a classpath resource to a file.
      Parameters:
      source - Resource.
      dest - Destination file.
      Throws:
      IOException - If something goes wrong.
    • copyResource

      void copyResource(@NonNull String source, @NonNull Path dest, @NonNull Set<PosixFilePermission> permissions) throws IOException
      Copy a classpath resource to a file.
      Parameters:
      source - Resource.
      dest - Destination file.
      permissions - File permissions.
      Throws:
      IOException - If something goes wrong.
    • getDependencyMap

      Map<String,String> getDependencyMap() throws IOException
      List all dependencies and their version. Like:
         kotlin.version = 1.2.3
       
      Returns:
      Dependency map.
      Throws:
      IOException - If something goes wrong.
    • readLine

      @NonNull String readLine(@NonNull String prompt)
      Ask user for input.
      Parameters:
      prompt - User prompt.
      Returns:
      Input value.
    • println

      void println(@NonNull String message)
      Write a message to console.
      Parameters:
      message - Message.
    • getVersion

      @NonNull String getVersion()
      Jooby version to use.
      Returns:
      Jooby version to use.
    • getWorkspace

      @NonNull Path getWorkspace()
      Working directory (where the projects are created).
      Returns:
      Working directory (where the projects are created).
    • setWorkspace

      void setWorkspace(@NonNull Path workspace) throws IOException
      Set workspace/working directory.
      Parameters:
      workspace - Workspace/working directory.
      Throws:
      IOException - When directory doesn't exist.