Compare commits
4 Commits
dependabot
...
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2a08a2c30 | ||
|
|
ac1e1f1ece | ||
|
|
fee9d8533c | ||
|
|
6f146516a8 |
20
.devcontainer/devcontainer.json
Normal file
20
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "terminal-ui",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/java:1-21-bookworm",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/java:1": {
|
||||||
|
"version": "21",
|
||||||
|
"installGradle": "true",
|
||||||
|
"installMaven": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postCreateCommand": "java -version && ./gradlew --version",
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"vscjava.vscode-gradle"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
.editorconfig
Normal file
20
.editorconfig
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# EditorConfig: consistent style across editors
|
||||||
|
# https://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{java,kts}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{yml,yaml,md,json}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.bat]
|
||||||
|
end_of_line = crlf
|
||||||
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Normalize line endings
|
||||||
|
* text=auto eol=lf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
|
||||||
|
# GitHub linguist: don't count these as language
|
||||||
|
gradle/wrapper/gradle-wrapper.jar binary
|
||||||
|
*.jar binary
|
||||||
|
*.zip binary
|
||||||
27
.github/release-drafter.yml
vendored
Normal file
27
.github/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Config for release-drafter v6: categorizes PRs in draft release notes
|
||||||
|
# https://github.com/release-drafter/release-drafter
|
||||||
|
|
||||||
|
template: |
|
||||||
|
## What's Changed
|
||||||
|
|
||||||
|
$CHANGES
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/jakubbbdev/terminal-ui/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
|
||||||
|
|
||||||
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
|
tag-template: 'v$RESOLVED_VERSION'
|
||||||
|
|
||||||
|
categories:
|
||||||
|
- title: '🚀 Features'
|
||||||
|
labels: [feature, enhancement]
|
||||||
|
- title: '🐛 Bug Fixes'
|
||||||
|
labels: [bug, fix]
|
||||||
|
- title: '📚 Documentation'
|
||||||
|
labels: [documentation]
|
||||||
|
- title: '⬆️ Dependencies'
|
||||||
|
labels: [dependencies]
|
||||||
|
- title: 'Other'
|
||||||
|
labels: ['*']
|
||||||
|
|
||||||
|
exclude-labels:
|
||||||
|
- skip-changelog
|
||||||
7
.github/workflows/codeql.yml
vendored
7
.github/workflows/codeql.yml
vendored
@@ -21,6 +21,13 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 21
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
22
.github/workflows/release-drafter.yml
vendored
Normal file
22
.github/workflows/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Drafts release notes from merged PRs when you create a release.
|
||||||
|
# Install: add a Release Drafter config (see below), then create a release on GitHub;
|
||||||
|
# this workflow will update the draft with categorized PRs.
|
||||||
|
name: Release Drafter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_release_draft:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Draft Release
|
||||||
|
uses: release-drafter/release-drafter@v6
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
# On push of a version tag (e.g. v1.0.0): build, create GitHub Release, upload JARs.
|
# On push of a version tag (e.g. v1.0.0): build, publish to GitHub Packages, create Release, upload JARs.
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -8,10 +8,13 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RELEASE_VERSION: ${{ github.ref_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,7 +26,13 @@ jobs:
|
|||||||
java-version: 21
|
java-version: 21
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
- run: chmod +x gradlew && ./gradlew build --no-daemon
|
- name: Strip v from version
|
||||||
|
run: echo "RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and publish to GitHub Packages
|
||||||
|
run: chmod +x gradlew && ./gradlew build publish --no-daemon
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
|||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
60
README.md
60
README.md
@@ -3,6 +3,54 @@
|
|||||||
Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList, pager, and more. Fluent API, ANSI support, testable.
|
Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList, pager, and more. Fluent API, ANSI support, testable.
|
||||||
|
|
||||||
[](https://github.com/jakubbbdev/terminal-ui/actions/workflows/ci.yml)
|
[](https://github.com/jakubbbdev/terminal-ui/actions/workflows/ci.yml)
|
||||||
|
[](https://openjdk.org/)
|
||||||
|
[](LICENSE)
|
||||||
|
|
||||||
|
[](https://codespaces.new/jakubbbdev/terminal-ui)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Published to [GitHub Packages](https://github.com/jakubbbdev/terminal-ui/packages). Replace `VERSION` with a [release](https://github.com/jakubbbdev/terminal-ui/releases) tag (e.g. `1.0.0`).
|
||||||
|
|
||||||
|
**Gradle (Kotlin DSL):**
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url = uri("https://maven.pkg.github.com/jakubbbdev/terminal-ui") }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
implementation("dev.jakub.terminal:terminal-ui:VERSION")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Gradle (Groovy):**
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url "https://maven.pkg.github.com/jakubbbdev/terminal-ui" }
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
implementation "dev.jakub.terminal:terminal-ui:VERSION"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Maven:**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<repository>
|
||||||
|
<id>github</id>
|
||||||
|
<url>https://maven.pkg.github.com/jakubbbdev/terminal-ui</url>
|
||||||
|
</repository>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.jakub.terminal</groupId>
|
||||||
|
<artifactId>terminal-ui</artifactId>
|
||||||
|
<version>VERSION</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
For public packages, read access usually works without credentials. If your tool asks for auth, use a [GitHub PAT](https://github.com/settings/tokens) with `read:packages` as username and the token as password.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@@ -21,18 +69,6 @@ Run tests:
|
|||||||
./gradlew test
|
./gradlew test
|
||||||
```
|
```
|
||||||
|
|
||||||
Demo (non-interactive):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./gradlew run
|
|
||||||
```
|
|
||||||
|
|
||||||
Interactive demo (best run in a real terminal):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./gradlew runDemo2
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage (excerpt)
|
## Usage (excerpt)
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|||||||
11
SECURITY.md
Normal file
11
SECURITY.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
## Reporting a vulnerability
|
||||||
|
|
||||||
|
If you find a security issue, please report it responsibly:
|
||||||
|
|
||||||
|
1. **Do not** open a public issue.
|
||||||
|
2. Email the maintainers or report via [GitHub Security Advisories](https://github.com/jakubbbdev/terminal-ui/security/advisories/new) (if enabled).
|
||||||
|
3. Give a clear description and steps to reproduce; we’ll respond as soon as we can.
|
||||||
|
|
||||||
|
Thank you for helping keep this project safe.
|
||||||
@@ -2,15 +2,15 @@ plugins {
|
|||||||
id("java")
|
id("java")
|
||||||
id("java-library")
|
id("java-library")
|
||||||
id("application")
|
id("application")
|
||||||
|
id("maven-publish")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<JavaExec>("run") {
|
tasks.named<JavaExec>("run") {
|
||||||
jvmArgs("-Ddev.jakub.terminal.ansi=true", "-Dfile.encoding=UTF-8")
|
jvmArgs("-Ddev.jakub.terminal.ansi=true", "-Dfile.encoding=UTF-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
group = "dev.jakub.terminal"
|
group = "dev.jakub.terminal"
|
||||||
version = "1.0-SNAPSHOT"
|
version = System.getenv("RELEASE_VERSION") ?: "1.0-SNAPSHOT"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
@@ -22,7 +22,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(platform("org.junit:junit-bom:6.0.3"))
|
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
}
|
}
|
||||||
@@ -30,3 +30,24 @@ dependencies {
|
|||||||
tasks.test {
|
tasks.test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
groupId = project.group.toString()
|
||||||
|
artifactId = "terminal-ui"
|
||||||
|
version = project.version.toString()
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "GitHubPackages"
|
||||||
|
url = uri("https://maven.pkg.github.com/jakubbbdev/terminal-ui")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user")?.toString()
|
||||||
|
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.token")?.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public final class Confirm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the given scanner for one line. Use when sharing one scanner (e.g. demo).
|
* Uses the given scanner for one line. Use when sharing one scanner (e.g. interactive app).
|
||||||
*/
|
*/
|
||||||
public boolean ask(Scanner sharedScanner) {
|
public boolean ask(Scanner sharedScanner) {
|
||||||
if (sharedScanner == null) return ask();
|
if (sharedScanner == null) return ask();
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public final class Prompt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts and returns the next line from the given scanner. Use this when
|
* Prompts and returns the next line from the given scanner. Use this when
|
||||||
* sharing one scanner (e.g. in a demo) so input blocks correctly.
|
* sharing one scanner (e.g. in an interactive app) so input blocks correctly.
|
||||||
*/
|
*/
|
||||||
public String ask(Scanner sharedScanner) {
|
public String ask(Scanner sharedScanner) {
|
||||||
if (sharedScanner == null) return ask();
|
if (sharedScanner == null) return ask();
|
||||||
|
|||||||
Reference in New Issue
Block a user