Available Commands
Complete reference for all S2D CLI commands and their usage.
🔗 Overview
S2D CLI provides a simple command-line interface with the following commands:
s2d --generate
- Generate a new S2D projects2d --help
- Display help informations2d
(no arguments) - Same as--help
🔗 --generate
Creates a new S2D project with all necessary files and dependencies.
Usage
s2d --generate
What it does
- Displays the S2D ASCII art banner
- Prompts for project configuration
- Creates project directory structure
- Downloads and configures S2D libraries from GitHub
- Sets up build files (sbt or scala-cli)
- Generates template main.scala file
- Copies required native libraries (Windows only)
- Creates assets directory
Interactive Prompts
The command will prompt you for:
- Project name - Default: "my-s2d-project"
- Build system - Options: scala-cli (default) or sbt
- Project path - Default: current directory
Generated Project Structure
my-s2d-project/
├── main.scala # Template application
├── project.scala # Scala-CLI configuration (if chosen)
├── build.sbt # SBT configuration (if chosen)
├── project/ # SBT project files (if chosen)
├── libraries/ # Downloaded S2D libraries
├── assets/ # Asset directory
├── SDL2.dll # Windows DLL (Windows only)
└── glew32.dll # Windows DLL (Windows only)
🔗 --help
Displays usage information and available commands.
Usage
s2d --help
Output
S2D - Scala 2D Native Library CLI Tool
Usage:
s2d --generate Generate a new S2D project template
s2d --help Show this help message
🔗 Interactive Commands
During the --generate
process, you can use these interactive commands:
Cancel Operation
Type cancel
at any prompt to exit the project generation process:
Enter project name [my-s2d-project]: cancel
Operation cancelled.
Default Values
Press Enter at any prompt to use the default value shown in brackets:
Enter project name [my-s2d-project]: ↵
# Uses "my-s2d-project" as the project name
🔗 Examples
Generate a New Project
$ s2d --generate
╔═══════════════════════════════════════╗
║ ║
║ ███████╗██████╗ ██████╗ ║
║ ██╔════╝╚════██╗██╔══██╗ ║
║ ███████╗ █████╔╝██║ ██║ ║
║ ╚════██║██╔═══╝ ██║ ██║ ║
║ ███████║███████╗██████╔╝ ║
║ ╚══════╝╚══════╝╚═════╝ ║
║ ║
║ Scala 2D Native Library ║
║ CLI Tool ║
║ ║
╚═══════════════════════════════════════╝
Starting S2D project template generation...
Enter project name [my-s2d-project]: my-game
Choose build system:
1. scala-cli (recommended)
2. sbt
0. cancel
Enter choice [1]: 1
Enter project path [.]: ./projects
Creating project 'my-game' at './projects'
Using build system: scala-cli
Creating project directory...
Downloading S2D libraries...
Setting up project files...
Creating assets directory...
Project 'my-game' created successfully!
Location: /path/to/projects/my-game
Get Help
$ s2d --help
S2D - Scala 2D Native Library CLI Tool
Usage:
s2d --generate Generate a new S2D project template
s2d --help Show this help message
Using Default Values
$ s2d --generate
# Accept all defaults by pressing Enter
Enter project name [my-s2d-project]: ↵
Choose build system:
1. scala-cli (recommended)
2. sbt
0. cancel
Enter choice [1]: ↵
Enter project path [.]: ↵
# Creates "my-s2d-project" with scala-cli in current directory