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(String template, Object model, 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(String source, 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(String source, Path dest, 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

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

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

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

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

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