diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml deleted file mode 100644 index 238241a..0000000 --- a/.github/workflows/gradle-publish.yml +++ /dev/null @@ -1,45 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle - -name: Gradle Package - -on: - release: - types: [created] - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'corretto' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - - - name: Build with Gradle - uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 - with: - arguments: build - - # The USERNAME and TOKEN need to correspond to the credentials environment variables used in - # the publishing section of your build.gradle - - name: Publish to GitHub Packages - uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 - with: - arguments: publish - env: - USERNAME: ${{ github.actor }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..9af3881 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,44 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'corretto' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Set up Maven settings + run: | + mkdir -p ~/.m2 + echo " + + + github + ${{ github.actor }} + ${{ secrets.ACCESS_TOKEN }} + + + " > ~/.m2/settings.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index bdf6333..142b1e6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ -# Espresso Argument Parser (EAP) -The **Espresso Argument Parser** is a library built for the [Espresso](https://github.com/hlafaille/espresso) build tool -to provide a clean and efficient way of handling command line arguments. See the `doc/` directory for more in depth -information. +# Argument Parser (arg) +The **Argument Parser** (arg) framework provides a clean and efficient way of handling command line arguments. # Features * Mimics the Docker CLI `resource -> action on resource` style @@ -32,7 +30,7 @@ information. public class Main() { public static void main(String[] args) { - EspressoArgumentParser espressoArgumentParser = new EspressoArgumentParser("Docker", "Containers, yo!"); + EspressoArgumentParser argumentParser = new EspressoArgumentParser("Docker", "Containers, yo!"); // build our command Command command = new Command("ps", "List all images on this system") { @@ -47,10 +45,10 @@ public class Main() { commandContainer.addCommand(command); // add that container to your parser - espressoArgumentParser.addCommandContainer(commandContainer); + argumentParser.addCommandContainer(commandContainer); // enter the parser - espressoArgumentParser.parse(args); + argumentParser.parse(args); } } ``` diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index c42f47d..0000000 --- a/build.gradle.kts +++ /dev/null @@ -1,35 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -plugins { - id("java") - id("com.github.johnrengelman.shadow") version "8.1.1" -} - -group = "xyz.hlafaille.espresso" -version = "1.0-SNAPSHOT" - -repositories { - mavenCentral() -} - -dependencies { - implementation("org.projectlombok:lombok:1.18.28") - - annotationProcessor("org.projectlombok:lombok:1.18.28") - testImplementation(platform("org.junit:junit-bom:5.9.1")) - testImplementation("org.junit.jupiter:junit-jupiter") -} - -tasks.test { - useJUnitPlatform() -} - -tasks { - named("shadowJar") { - archiveFileName.set("eap.jar") - mergeServiceFiles() - manifest { - attributes(mapOf("Main-Class" to "xyz.hlafaille.eap.Main")) - } - } -} \ No newline at end of file diff --git a/doc/EspressoArgumentParser.odg b/doc/EspressoArgumentParser.odg deleted file mode 100644 index 58730c9..0000000 Binary files a/doc/EspressoArgumentParser.odg and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e583..0000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 151f3aa..0000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Nov 18 22:04:43 EST 2023 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew deleted file mode 100755 index 1b6c787..0000000 --- a/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index ac1b06f..0000000 --- a/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e200f2a --- /dev/null +++ b/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + io.kerosenelabs + arg + jar + 0.1.0 + arg + http://maven.apache.org + + + + org.junit.jupiter + junit-jupiter-api + 5.10.3 + test + + + org.projectlombok + lombok + 1.18.34 + provided + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 21 + 21 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.2 + + + + true + lib/ + io.kerosenelabs.arg.Main + + + + + + + + + github + GitHub Kerosene-Labs Apache Maven Packages + https://maven.pkg.github.com/Kerosene-Labs/arg + + + \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index 623b22a..0000000 --- a/settings.gradle.kts +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = "espresso-argumentparser" - diff --git a/src/main/java/xyz/hlafaille/eap/EspressoArgumentParser.java b/src/main/java/io/kerosenelabs/arg/ArgumentParser.java similarity index 77% rename from src/main/java/xyz/hlafaille/eap/EspressoArgumentParser.java rename to src/main/java/io/kerosenelabs/arg/ArgumentParser.java index bf3af76..b472c4e 100644 --- a/src/main/java/xyz/hlafaille/eap/EspressoArgumentParser.java +++ b/src/main/java/io/kerosenelabs/arg/ArgumentParser.java @@ -1,20 +1,20 @@ -package xyz.hlafaille.eap; +package io.kerosenelabs.arg; +import io.kerosenelabs.arg.buitlin.exceptionhandler.*; +import io.kerosenelabs.arg.exception.*; import lombok.Getter; -import xyz.hlafaille.eap.buitlin.exceptionhandler.*; -import xyz.hlafaille.eap.exception.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** - *

Espresso Argument Parser (EAP)

- * Instantiate this singleton once in your entrypoint method. the Espresso Argument Parser is effectively the main class + *

Argument Parser (EAP)

+ * Instantiate this singleton once in your entrypoint method. The Argument Parser is effectively the main class * of your command line application. */ -public class EspressoArgumentParser { - private static EspressoArgumentParser instance; +public class ArgumentParser { + private static ArgumentParser instance; @Getter private final String applicationName; @@ -31,9 +31,9 @@ public class EspressoArgumentParser { * @param applicationName The name of your EAP application * @param applicationDescription A short description of your EAP application */ - public EspressoArgumentParser(String applicationName, String applicationDescription) { + public ArgumentParser(String applicationName, String applicationDescription) { if (instance != null) { - throw new RuntimeException("An EspressoArgumentParser has already been instantiated (application name=\"%s\")".formatted(applicationName)); + throw new RuntimeException("An ArgumentParser has already been instantiated (application name=\"%s\")".formatted(applicationName)); } this.applicationName = applicationName; this.applicationDescription = applicationDescription; @@ -51,11 +51,11 @@ public EspressoArgumentParser(String applicationName, String applicationDescript /** * Get the singleton instance * - * @return Singleton of EspressoArgumentParser + * @return Singleton of ArgumentParser */ - private static EspressoArgumentParser getInstance() { + private static ArgumentParser getInstance() { if (instance == null) { - throw new RuntimeException("An EspressoArgumentParser was never instantiated, therefore there is no instance to retrieve"); + throw new RuntimeException("An ArgumentParser was never instantiated, therefore there is no instance to retrieve"); } return instance; } @@ -65,10 +65,10 @@ private static EspressoArgumentParser getInstance() { * * @param commandContainer CommandContainer instance */ - public void addCommandContainer(CommandContainer commandContainer) throws EapDuplicateCommandContainerException { + public void addCommandContainer(CommandContainer commandContainer) throws DuplicateCommandContainerException { for (CommandContainer iterCommandContainer : commandContainerList) { if (iterCommandContainer.getName().equals(commandContainer.getName())) { - throw new EapDuplicateCommandContainerException(); + throw new DuplicateCommandContainerException(); } } commandContainerList.add(commandContainer); @@ -79,10 +79,10 @@ public void addCommandContainer(CommandContainer commandContainer) throws EapDup * * @param command Command instance */ - public void addCommand(Command command) throws EapDuplicateCommandException { + public void addCommand(Command command) throws DuplicateCommandException { for (Command iterCommand : commandList) { if (iterCommand.getName().equals(command.getName())) { - throw new EapDuplicateCommandException(); + throw new DuplicateCommandException(); } } commandList.add(command); @@ -94,10 +94,10 @@ public void addCommand(Command command) throws EapDuplicateCommandException { * * @param commandContainer Command Container to search under */ - private void parseInCommandContainer(CommandContainer commandContainer, String[] remainingArgs) throws EapCommandNotFoundException, EapMalformedCommandModifierException, EapCommandModifierNotFoundException, EapCommandNotSpecifiedException { + private void parseInCommandContainer(CommandContainer commandContainer, String[] remainingArgs) throws CommandNotFoundException, MalformedCommandModifierException, CommandModifierNotFoundException, CommandNotSpecifiedException { // check if the user specified a command after their subcommand if (remainingArgs.length == 0) { - throw new EapCommandNotSpecifiedException(commandContainer.getName()); + throw new CommandNotSpecifiedException(commandContainer.getName()); } // separate out our next-in-line command @@ -118,7 +118,7 @@ private void parseInCommandContainer(CommandContainer commandContainer, String[] return; } } - throw new EapCommandNotFoundException(commandName); + throw new CommandNotFoundException(commandName); } /** @@ -133,7 +133,7 @@ public void addExceptionHandler(ExceptionHandler exceptionHandler) { * * @param arguments Arg array from main method */ - public void parse(String[] arguments) throws EapMissingSubcommandException, EapCommandNotFoundException, EapMalformedCommandModifierException, EapSubcommandNotFoundException, EapCommandModifierNotFoundException, EapCommandNotSpecifiedException { + public void parse(String[] arguments) throws EapMissingSubcommandException, CommandNotFoundException, MalformedCommandModifierException, EapSubcommandNotFoundException, CommandModifierNotFoundException, CommandNotSpecifiedException { try { // if no arguments were provided if (arguments.length == 0) { diff --git a/src/main/java/xyz/hlafaille/eap/Command.java b/src/main/java/io/kerosenelabs/arg/Command.java similarity index 77% rename from src/main/java/xyz/hlafaille/eap/Command.java rename to src/main/java/io/kerosenelabs/arg/Command.java index 82397b4..d8a72bb 100644 --- a/src/main/java/xyz/hlafaille/eap/Command.java +++ b/src/main/java/io/kerosenelabs/arg/Command.java @@ -1,14 +1,14 @@ -package xyz.hlafaille.eap; +package io.kerosenelabs.arg; +import io.kerosenelabs.arg.exception.CommandModifierNotFoundException; +import io.kerosenelabs.arg.exception.MalformedCommandModifierException; import lombok.Getter; -import xyz.hlafaille.eap.exception.EapCommandModifierNotFoundException; -import xyz.hlafaille.eap.exception.EapMalformedCommandModifierException; import java.util.ArrayList; import java.util.List; /** - *

Espresso Argument Parser Command

+ *

Argument Parser Command

*/ public abstract class Command { @Getter @@ -36,17 +36,17 @@ public void addCommandModifier(CommandModifier commandModifier) { } /** - * Automatically called by the EspressoArgumentParser, this method primarily does parsing and type checking on + * Automatically called by the ArgumentParser, this method primarily does parsing and type checking on * any potential command modifiers passed. * * @param remainingArgs Array of remaining args */ - public void preExecute(String[] remainingArgs) throws EapMalformedCommandModifierException, EapCommandModifierNotFoundException { + public void preExecute(String[] remainingArgs) throws MalformedCommandModifierException, CommandModifierNotFoundException { List commandModifiers = new ArrayList<>(); for (String arg : remainingArgs) { // if this command modifier doesn't include "--" if (!arg.contains("--")) { - throw new EapMalformedCommandModifierException(arg); + throw new MalformedCommandModifierException(arg); } // strip out the "--" @@ -63,7 +63,7 @@ public void preExecute(String[] remainingArgs) throws EapMalformedCommandModifie // if the requested command modifier could not be found if (!commandModifierMatchFound) { - throw new EapCommandModifierNotFoundException(arg); + throw new CommandModifierNotFoundException(arg); } } execute(commandModifiers); diff --git a/src/main/java/xyz/hlafaille/eap/CommandContainer.java b/src/main/java/io/kerosenelabs/arg/CommandContainer.java similarity index 97% rename from src/main/java/xyz/hlafaille/eap/CommandContainer.java rename to src/main/java/io/kerosenelabs/arg/CommandContainer.java index a857d0f..12b227b 100644 --- a/src/main/java/xyz/hlafaille/eap/CommandContainer.java +++ b/src/main/java/io/kerosenelabs/arg/CommandContainer.java @@ -1,4 +1,4 @@ -package xyz.hlafaille.eap; +package io.kerosenelabs.arg; import lombok.Getter; diff --git a/src/main/java/xyz/hlafaille/eap/CommandModifier.java b/src/main/java/io/kerosenelabs/arg/CommandModifier.java similarity index 85% rename from src/main/java/xyz/hlafaille/eap/CommandModifier.java rename to src/main/java/io/kerosenelabs/arg/CommandModifier.java index 740e2e2..74d2f54 100644 --- a/src/main/java/xyz/hlafaille/eap/CommandModifier.java +++ b/src/main/java/io/kerosenelabs/arg/CommandModifier.java @@ -1,10 +1,9 @@ -package xyz.hlafaille.eap; +package io.kerosenelabs.arg; -import lombok.AllArgsConstructor; import lombok.Getter; /** - *

Espresso Argument Parser Command Modifier

+ *

Argument Parser Command Modifier

* A command modifier can modify the input/output of a command, but shouldn't be considered an "input". For example, * with the following Docker command: *

diff --git a/src/main/java/xyz/hlafaille/eap/ExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/ExceptionHandler.java similarity index 78% rename from src/main/java/xyz/hlafaille/eap/ExceptionHandler.java rename to src/main/java/io/kerosenelabs/arg/ExceptionHandler.java index 23fb6ed..0ea2cd5 100644 --- a/src/main/java/xyz/hlafaille/eap/ExceptionHandler.java +++ b/src/main/java/io/kerosenelabs/arg/ExceptionHandler.java @@ -1,9 +1,7 @@ -package xyz.hlafaille.eap; - -import lombok.Getter; +package io.kerosenelabs.arg; /** - * Tells the Espresso Argument Parser how to deal with a specific exception + * Tells the Argument Parser how to deal with a specific exception */ public abstract class ExceptionHandler { private final Class exceptionClass; diff --git a/src/main/java/io/kerosenelabs/arg/Main.java b/src/main/java/io/kerosenelabs/arg/Main.java new file mode 100644 index 0000000..a47a5a9 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/Main.java @@ -0,0 +1,23 @@ +package io.kerosenelabs.arg; + +import io.kerosenelabs.arg.exception.*; + +import java.util.List; + +public class Main { + public static void main(String[] args) throws CommandNotFoundException, EapMissingSubcommandException, DuplicateCommandContainerException, MalformedCommandModifierException, EapSubcommandNotFoundException, CommandModifierNotFoundException, CommandNotSpecifiedException, DuplicateCommandException { + ArgumentParser argumentParser = new ArgumentParser("EAP Application", "Test"); + + // build our command + Command command = new Command("test", "test") { + @Override + public void execute(List commandModifiers) { + System.out.println(commandModifiers); + } + }; + argumentParser.addCommand(command); + + // entrypoint + argumentParser.parse(args); + } +} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java similarity index 53% rename from src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java rename to src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java index 0a2552c..50cbeb4 100644 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandModifierNotFoundExceptionHandler.java @@ -1,15 +1,15 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; +package io.kerosenelabs.arg.buitlin.exceptionhandler; -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException; -import xyz.hlafaille.eap.util.ColorLogger; +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.CommandNotSpecifiedException; +import io.kerosenelabs.arg.util.ColorLogger; /** * Built in exception handler for: xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException */ -public class EapCommandModifierNotFoundExceptionHandler extends ExceptionHandler { +public class EapCommandModifierNotFoundExceptionHandler extends ExceptionHandler { public EapCommandModifierNotFoundExceptionHandler() { - super(EapCommandNotSpecifiedException.class); + super(CommandNotSpecifiedException.class); } @Override diff --git a/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java new file mode 100644 index 0000000..7d09c93 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java @@ -0,0 +1,19 @@ +package io.kerosenelabs.arg.buitlin.exceptionhandler; + +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.CommandNotFoundException; +import io.kerosenelabs.arg.util.ColorLogger; + +/** + * Built in exception handler for: xyz.hlafaille.eap.exception.EapCommandNotFoundExceptionHandler + */ +public class EapCommandNotFoundExceptionHandler extends ExceptionHandler { + public EapCommandNotFoundExceptionHandler() { + super(CommandNotFoundException.class); + } + + @Override + public void execute(Exception exception) { + ColorLogger.severe(exception.getMessage()); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java new file mode 100644 index 0000000..4fddcb0 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java @@ -0,0 +1,19 @@ +package io.kerosenelabs.arg.buitlin.exceptionhandler; + +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.CommandNotSpecifiedException; +import io.kerosenelabs.arg.util.ColorLogger; + +/** + * Built in exception handler for: xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException + */ +public class EapCommandNotSpecifiedExceptionHandler extends ExceptionHandler { + public EapCommandNotSpecifiedExceptionHandler() { + super(CommandNotSpecifiedException.class); + } + + @Override + public void execute(Exception exception) { + ColorLogger.severe(exception.getMessage()); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java new file mode 100644 index 0000000..e49d029 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java @@ -0,0 +1,19 @@ +package io.kerosenelabs.arg.buitlin.exceptionhandler; + +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.DuplicateCommandContainerException; +import io.kerosenelabs.arg.util.ColorLogger; + +/** + * Built in exception handler for: xyz.hlafaille.eap.exception.EapDuplicateCommandContainerException + */ +public class EapDuplicateCommandContainerExceptionHandler extends ExceptionHandler { + public EapDuplicateCommandContainerExceptionHandler() { + super(DuplicateCommandContainerException.class); + } + + @Override + public void execute(Exception exception) { + ColorLogger.severe(exception.getMessage()); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java new file mode 100644 index 0000000..3d86485 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java @@ -0,0 +1,19 @@ +package io.kerosenelabs.arg.buitlin.exceptionhandler; + +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.DuplicateCommandException; +import io.kerosenelabs.arg.util.ColorLogger; + +/** + * Built in exception handler for: xyz.hlafaille.eap.exception.EapDuplicateCommandException + */ +public class EapDuplicateCommandExceptionHandler extends ExceptionHandler { + public EapDuplicateCommandExceptionHandler() { + super(DuplicateCommandException.class); + } + + @Override + public void execute(Exception exception) { + ColorLogger.severe(exception.getMessage()); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java new file mode 100644 index 0000000..e671b59 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java @@ -0,0 +1,19 @@ +package io.kerosenelabs.arg.buitlin.exceptionhandler; + +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.MalformedCommandModifierException; +import io.kerosenelabs.arg.util.ColorLogger; + +/** + * Built in exception handler for: xyz.hlafaille.eap.exception.EapMalformedCommandModifierException + */ +public class EapMalformedCommandModifierExceptionHandler extends ExceptionHandler { + public EapMalformedCommandModifierExceptionHandler() { + super(MalformedCommandModifierException.class); + } + + @Override + public void execute(Exception exception) { + ColorLogger.severe(exception.getMessage()); + } +} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java similarity index 61% rename from src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java rename to src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java index ee3ef44..5e2daed 100644 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapMissingSubcommandExceptionHandler.java @@ -1,9 +1,8 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; +package io.kerosenelabs.arg.buitlin.exceptionhandler; -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapMalformedCommandModifierException; -import xyz.hlafaille.eap.exception.EapMissingSubcommandException; -import xyz.hlafaille.eap.util.ColorLogger; +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.EapMissingSubcommandException; +import io.kerosenelabs.arg.util.ColorLogger; /** * Built in exception handler for: xyz.hlafaille.eap.exception.EapMissingSubcommandException diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java similarity index 62% rename from src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java rename to src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java index 91a0572..2d7c048 100644 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java +++ b/src/main/java/io/kerosenelabs/arg/buitlin/exceptionhandler/EapSubcommandNotFoundExceptionHandler.java @@ -1,9 +1,8 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; +package io.kerosenelabs.arg.buitlin.exceptionhandler; -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapMissingSubcommandException; -import xyz.hlafaille.eap.exception.EapSubcommandNotFoundException; -import xyz.hlafaille.eap.util.ColorLogger; +import io.kerosenelabs.arg.ExceptionHandler; +import io.kerosenelabs.arg.exception.EapSubcommandNotFoundException; +import io.kerosenelabs.arg.util.ColorLogger; /** * Built in exception handler for: xyz.hlafaille.eap.exception.EapSubcommandNotFoundException diff --git a/src/main/java/io/kerosenelabs/arg/exception/CommandModifierNotFoundException.java b/src/main/java/io/kerosenelabs/arg/exception/CommandModifierNotFoundException.java new file mode 100644 index 0000000..04d39b4 --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/exception/CommandModifierNotFoundException.java @@ -0,0 +1,7 @@ +package io.kerosenelabs.arg.exception; + +public class CommandModifierNotFoundException extends Exception{ + public CommandModifierNotFoundException(String userInput) { + super("Command modifier not found: %s".formatted(userInput)); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/exception/CommandNotFoundException.java b/src/main/java/io/kerosenelabs/arg/exception/CommandNotFoundException.java new file mode 100644 index 0000000..63dc9fc --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/exception/CommandNotFoundException.java @@ -0,0 +1,7 @@ +package io.kerosenelabs.arg.exception; + +public class CommandNotFoundException extends Exception{ + public CommandNotFoundException(String command) { + super("No commands or subcommands could be found with the name '%s'".formatted(command)); + } +} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapCommandNotSpecifiedException.java b/src/main/java/io/kerosenelabs/arg/exception/CommandNotSpecifiedException.java similarity index 63% rename from src/main/java/xyz/hlafaille/eap/exception/EapCommandNotSpecifiedException.java rename to src/main/java/io/kerosenelabs/arg/exception/CommandNotSpecifiedException.java index cbc2548..7cad858 100644 --- a/src/main/java/xyz/hlafaille/eap/exception/EapCommandNotSpecifiedException.java +++ b/src/main/java/io/kerosenelabs/arg/exception/CommandNotSpecifiedException.java @@ -1,11 +1,11 @@ -package xyz.hlafaille.eap.exception; +package io.kerosenelabs.arg.exception; /** * Represents a scenario in which a user types the name of a command container, but not a command under that. * For example, calling `espresso project` will throw this exception */ -public class EapCommandNotSpecifiedException extends Exception { - public EapCommandNotSpecifiedException(String userInput) { +public class CommandNotSpecifiedException extends Exception { + public CommandNotSpecifiedException(String userInput) { super("A command must be specified when calling '%s'".formatted(userInput)); } } diff --git a/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandContainerException.java b/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandContainerException.java new file mode 100644 index 0000000..773299f --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandContainerException.java @@ -0,0 +1,7 @@ +package io.kerosenelabs.arg.exception; + +public class DuplicateCommandContainerException extends Exception{ + public DuplicateCommandContainerException() { + super("Duplicates under command containers are not allowed"); + } +} diff --git a/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandException.java b/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandException.java new file mode 100644 index 0000000..5c91a7d --- /dev/null +++ b/src/main/java/io/kerosenelabs/arg/exception/DuplicateCommandException.java @@ -0,0 +1,7 @@ +package io.kerosenelabs.arg.exception; + +public class DuplicateCommandException extends Exception{ + public DuplicateCommandException() { + super("Duplicate commands are not allowed"); + } +} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapMissingSubcommandException.java b/src/main/java/io/kerosenelabs/arg/exception/EapMissingSubcommandException.java similarity index 80% rename from src/main/java/xyz/hlafaille/eap/exception/EapMissingSubcommandException.java rename to src/main/java/io/kerosenelabs/arg/exception/EapMissingSubcommandException.java index d91bd07..5c3aabe 100644 --- a/src/main/java/xyz/hlafaille/eap/exception/EapMissingSubcommandException.java +++ b/src/main/java/io/kerosenelabs/arg/exception/EapMissingSubcommandException.java @@ -1,4 +1,4 @@ -package xyz.hlafaille.eap.exception; +package io.kerosenelabs.arg.exception; public class EapMissingSubcommandException extends Exception{ public EapMissingSubcommandException() { diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapSubcommandNotFoundException.java b/src/main/java/io/kerosenelabs/arg/exception/EapSubcommandNotFoundException.java similarity index 84% rename from src/main/java/xyz/hlafaille/eap/exception/EapSubcommandNotFoundException.java rename to src/main/java/io/kerosenelabs/arg/exception/EapSubcommandNotFoundException.java index 841f5bb..abd4d59 100644 --- a/src/main/java/xyz/hlafaille/eap/exception/EapSubcommandNotFoundException.java +++ b/src/main/java/io/kerosenelabs/arg/exception/EapSubcommandNotFoundException.java @@ -1,4 +1,4 @@ -package xyz.hlafaille.eap.exception; +package io.kerosenelabs.arg.exception; public class EapSubcommandNotFoundException extends Exception{ public EapSubcommandNotFoundException(String command) { diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapMalformedCommandModifierException.java b/src/main/java/io/kerosenelabs/arg/exception/MalformedCommandModifierException.java similarity index 55% rename from src/main/java/xyz/hlafaille/eap/exception/EapMalformedCommandModifierException.java rename to src/main/java/io/kerosenelabs/arg/exception/MalformedCommandModifierException.java index 6f4f5d0..000017e 100644 --- a/src/main/java/xyz/hlafaille/eap/exception/EapMalformedCommandModifierException.java +++ b/src/main/java/io/kerosenelabs/arg/exception/MalformedCommandModifierException.java @@ -1,10 +1,10 @@ -package xyz.hlafaille.eap.exception; +package io.kerosenelabs.arg.exception; /** * Represents a scenario in which the user provides a command modifier that was not expected or malformed */ -public class EapMalformedCommandModifierException extends Exception { - public EapMalformedCommandModifierException(String userInput) { +public class MalformedCommandModifierException extends Exception { + public MalformedCommandModifierException(String userInput) { super("Malformed command modifier, user provided input was: %s".formatted(userInput)); } } diff --git a/src/main/java/xyz/hlafaille/eap/util/ColorLogger.java b/src/main/java/io/kerosenelabs/arg/util/ColorLogger.java similarity index 92% rename from src/main/java/xyz/hlafaille/eap/util/ColorLogger.java rename to src/main/java/io/kerosenelabs/arg/util/ColorLogger.java index 36537bd..b468e08 100644 --- a/src/main/java/xyz/hlafaille/eap/util/ColorLogger.java +++ b/src/main/java/io/kerosenelabs/arg/util/ColorLogger.java @@ -1,7 +1,4 @@ -package xyz.hlafaille.eap.util; - -import lombok.Getter; - +package io.kerosenelabs.arg.util; public class ColorLogger { public static final String ANSI_RESET = "\u001B[0m"; diff --git a/src/main/java/xyz/hlafaille/eap/Main.java b/src/main/java/xyz/hlafaille/eap/Main.java deleted file mode 100644 index 39eab3b..0000000 --- a/src/main/java/xyz/hlafaille/eap/Main.java +++ /dev/null @@ -1,24 +0,0 @@ -package xyz.hlafaille.eap; - -import xyz.hlafaille.eap.buitlin.exceptionhandler.EapCommandModifierNotFoundExceptionHandler; -import xyz.hlafaille.eap.exception.*; - -import java.util.List; - -public class Main { - public static void main(String[] args) throws EapCommandNotFoundException, EapMissingSubcommandException, EapDuplicateCommandContainerException, EapMalformedCommandModifierException, EapSubcommandNotFoundException, EapCommandModifierNotFoundException, EapCommandNotSpecifiedException, EapDuplicateCommandException { - EspressoArgumentParser espressoArgumentParser = new EspressoArgumentParser("EAP Application", "Test"); - - // build our command - Command command = new Command("test", "test") { - @Override - public void execute(List commandModifiers) { - System.out.println(commandModifiers); - } - }; - espressoArgumentParser.addCommand(command); - - // entrypoint - espressoArgumentParser.parse(args); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java b/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java deleted file mode 100644 index c028524..0000000 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotFoundExceptionHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; - -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapCommandNotFoundException; -import xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException; -import xyz.hlafaille.eap.util.ColorLogger; - -/** - * Built in exception handler for: xyz.hlafaille.eap.exception.EapCommandNotFoundExceptionHandler - */ -public class EapCommandNotFoundExceptionHandler extends ExceptionHandler { - public EapCommandNotFoundExceptionHandler() { - super(EapCommandNotFoundException.class); - } - - @Override - public void execute(Exception exception) { - ColorLogger.severe(exception.getMessage()); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java b/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java deleted file mode 100644 index cfd72da..0000000 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapCommandNotSpecifiedExceptionHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; - -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapCommandNotFoundException; -import xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException; -import xyz.hlafaille.eap.util.ColorLogger; - -/** - * Built in exception handler for: xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException - */ -public class EapCommandNotSpecifiedExceptionHandler extends ExceptionHandler { - public EapCommandNotSpecifiedExceptionHandler() { - super(EapCommandNotSpecifiedException.class); - } - - @Override - public void execute(Exception exception) { - ColorLogger.severe(exception.getMessage()); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java b/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java deleted file mode 100644 index 2708248..0000000 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandContainerExceptionHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; - -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapCommandNotSpecifiedException; -import xyz.hlafaille.eap.exception.EapDuplicateCommandContainerException; -import xyz.hlafaille.eap.util.ColorLogger; - -/** - * Built in exception handler for: xyz.hlafaille.eap.exception.EapDuplicateCommandContainerException - */ -public class EapDuplicateCommandContainerExceptionHandler extends ExceptionHandler { - public EapDuplicateCommandContainerExceptionHandler() { - super(EapDuplicateCommandContainerException.class); - } - - @Override - public void execute(Exception exception) { - ColorLogger.severe(exception.getMessage()); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java b/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java deleted file mode 100644 index 3b7b40a..0000000 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapDuplicateCommandExceptionHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; - -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapDuplicateCommandContainerException; -import xyz.hlafaille.eap.exception.EapDuplicateCommandException; -import xyz.hlafaille.eap.util.ColorLogger; - -/** - * Built in exception handler for: xyz.hlafaille.eap.exception.EapDuplicateCommandException - */ -public class EapDuplicateCommandExceptionHandler extends ExceptionHandler { - public EapDuplicateCommandExceptionHandler() { - super(EapDuplicateCommandException.class); - } - - @Override - public void execute(Exception exception) { - ColorLogger.severe(exception.getMessage()); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java b/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java deleted file mode 100644 index 09322c5..0000000 --- a/src/main/java/xyz/hlafaille/eap/buitlin/exceptionhandler/EapMalformedCommandModifierExceptionHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package xyz.hlafaille.eap.buitlin.exceptionhandler; - -import xyz.hlafaille.eap.ExceptionHandler; -import xyz.hlafaille.eap.exception.EapDuplicateCommandContainerException; -import xyz.hlafaille.eap.exception.EapMalformedCommandModifierException; -import xyz.hlafaille.eap.util.ColorLogger; - -/** - * Built in exception handler for: xyz.hlafaille.eap.exception.EapMalformedCommandModifierException - */ -public class EapMalformedCommandModifierExceptionHandler extends ExceptionHandler { - public EapMalformedCommandModifierExceptionHandler() { - super(EapMalformedCommandModifierException.class); - } - - @Override - public void execute(Exception exception) { - ColorLogger.severe(exception.getMessage()); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapCommandModifierNotFoundException.java b/src/main/java/xyz/hlafaille/eap/exception/EapCommandModifierNotFoundException.java deleted file mode 100644 index 3d17ccc..0000000 --- a/src/main/java/xyz/hlafaille/eap/exception/EapCommandModifierNotFoundException.java +++ /dev/null @@ -1,7 +0,0 @@ -package xyz.hlafaille.eap.exception; - -public class EapCommandModifierNotFoundException extends Exception{ - public EapCommandModifierNotFoundException(String userInput) { - super("Command modifier not found: %s".formatted(userInput)); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapCommandNotFoundException.java b/src/main/java/xyz/hlafaille/eap/exception/EapCommandNotFoundException.java deleted file mode 100644 index a252d64..0000000 --- a/src/main/java/xyz/hlafaille/eap/exception/EapCommandNotFoundException.java +++ /dev/null @@ -1,7 +0,0 @@ -package xyz.hlafaille.eap.exception; - -public class EapCommandNotFoundException extends Exception{ - public EapCommandNotFoundException(String command) { - super("No commands or subcommands could be found with the name '%s'".formatted(command)); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandContainerException.java b/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandContainerException.java deleted file mode 100644 index 2f3a8b1..0000000 --- a/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandContainerException.java +++ /dev/null @@ -1,7 +0,0 @@ -package xyz.hlafaille.eap.exception; - -public class EapDuplicateCommandContainerException extends Exception{ - public EapDuplicateCommandContainerException() { - super("Duplicates under command containers are not allowed"); - } -} diff --git a/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandException.java b/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandException.java deleted file mode 100644 index d4d85b4..0000000 --- a/src/main/java/xyz/hlafaille/eap/exception/EapDuplicateCommandException.java +++ /dev/null @@ -1,7 +0,0 @@ -package xyz.hlafaille.eap.exception; - -public class EapDuplicateCommandException extends Exception{ - public EapDuplicateCommandException() { - super("Duplicate commands are not allowed"); - } -} diff --git a/src/test/java/xyz/hlafaille/eap/TestEspressoArgumentParser.java b/src/test/java/io/kerosenelabs/arg/TestEspressoArgumentParser.java similarity index 60% rename from src/test/java/xyz/hlafaille/eap/TestEspressoArgumentParser.java rename to src/test/java/io/kerosenelabs/arg/TestEspressoArgumentParser.java index 74e74fa..7244d79 100644 --- a/src/test/java/xyz/hlafaille/eap/TestEspressoArgumentParser.java +++ b/src/test/java/io/kerosenelabs/arg/TestEspressoArgumentParser.java @@ -1,4 +1,4 @@ -package xyz.hlafaille.eap; +package io.kerosenelabs.arg; public class TestEspressoArgumentParser { }