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 Summary
Modifier and TypeMethodDescriptionvoidcopyResource(String source, Path dest) Copy a classpath resource to a file.voidcopyResource(String source, Path dest, Set<PosixFilePermission> permissions) Copy a classpath resource to a file.voidexit(int code) Exit application.List all dependencies and their version.Jooby version to use.Working directory (where the projects are created).voidWrite a message to console.Ask user for input.voidsetWorkspace(Path workspace) Set workspace/working directory.voidwriteTemplate(String template, Object model, Path file) Look for the given template and dump/write to the file.
-
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
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
List all dependencies and their version. Like:kotlin.version = 1.2.3
- Returns:
- Dependency map.
- Throws:
IOException- If something goes wrong.
-
readLine
Ask user for input.- Parameters:
prompt- User prompt.- Returns:
- Input value.
-
println
Write a message to console.- Parameters:
message- Message.
-
getVersion
Jooby version to use.- Returns:
- Jooby version to use.
-
getWorkspace
Working directory (where the projects are created).- Returns:
- Working directory (where the projects are created).
-
setWorkspace
Set workspace/working directory.- Parameters:
workspace- Workspace/working directory.- Throws:
IOException- When directory doesn't exist.
-