Skip to content

Commit

Permalink
basic help command
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Mar 24, 2023
1 parent 662d5ac commit dc94527
Show file tree
Hide file tree
Showing 19 changed files with 718 additions and 12 deletions.
325 changes: 325 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 - Yupiik SAS - https://www.yupiik.com
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
http://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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand All @@ -7,6 +24,9 @@
<groupId>io.yupiik.yuc</groupId>
<artifactId>yuc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Yupiik Yuc</name>
<description>Simple JSON/XML2JSON CLI formatter.</description>
<url>https://yupiik.github.io/yuc/</url>

<properties>
<maven.compiler.release>17</maven.compiler.release>
Expand Down Expand Up @@ -72,11 +92,151 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<excludes>
<exclude>**/build/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>4.2.rc3</version>
<executions>
<execution>
<id>check-license</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<inherited>false</inherited>
<configuration>
<aggregate>true</aggregate>
<mapping>
<adoc>DOUBLESLASH_STYLE</adoc>
</mapping>
<licenseSets>
<licenseSet>
<inlineHeader><![CDATA[Copyright (c) ${project.inceptionYear} - ${project.organization.name} - ${project.organization.url}
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
http://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.
]]></inlineHeader>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>**/*.properties</include>
<include>**/*.java</include>
<include>**/*.xml</include>
<include>**/*.yaml</include>
</includes>
<excludes>
<exclude>LICENSE</exclude>
<exclude>**/*.adoc</exclude>
<exclude>**/*.idea</exclude>
<exclude>**/target/**</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/minisite/**</exclude>
<exclude>**/file</exclude>
<exclude>**/.m2/**</exclude>
</excludes>
</licenseSet>
</licenseSets>
</configuration>
</plugin>
<plugin><!-- mvn ossindex:audit -->
<groupId>org.sonatype.ossindex.maven</groupId>
<artifactId>ossindex-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>audit-dependencies</id>
<phase/>
<goals>
<goal>audit</goal>
</goals>
</execution>
</executions>
<configuration>
<scope>compile,runtime</scope>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<parameters>true</parameters>
<source>${maven.compiler.release}</source>
<target>${maven.compiler.release}</target>
<release>${maven.compiler.release}</release>
Expand All @@ -87,13 +247,178 @@
<artifactId>arthur-maven-plugin</artifactId>
<version>1.0.5</version>
<configuration>
<customOptions>
<customOption>--verbose</customOption>
</customOptions>
<main>io.yupiik.yuc.Yuc</main>
<graalVersion>22.3.0.r17</graalVersion>
<enableAllSecurityServices>false</enableAllSecurityServices>
<allowIncompleteClasspath>false</allowIncompleteClasspath>
<buildStaticImage>true</buildStaticImage>
</configuration>
</plugin>
<!-- mvn [process-classes] yupiik-tools:serve-minisite -e -->
<plugin>
<groupId>io.yupiik.maven</groupId>
<artifactId>yupiik-tools-maven-plugin</artifactId>
<version>1.1.2</version>
<executions>
<execution>
<id>force-gen</id>
<phase>process-classes</phase>
<goals>
<goal>minisite</goal>
</goals>
<configuration>
<skipRendering>true</skipRendering>
</configuration>
</execution>
</executions>
<configuration>
<siteBase>/yuc/</siteBase>
<preActions>
<preAction>
<type>io.yupiik.yuc.build.documentation.GenerateCliOpts</type>
<configuration>
<output.doc>${project.basedir}/src/main/minisite/content/_partials/generated/cli.options.adoc</output.doc>
<!-- this one could move to a exec:java but simpler to do it at once while site is small enough to not add overhead -->
<output.help>${project.build.outputDirectory}/io/yupiik/yuc/command/HelpCommand.txt</output.help>
</configuration>
</preAction>
</preActions>
</configuration>
</plugin>
</plugins>
</build>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://github.com/yupiik/uship/blob/master/LICENSE</url>
<distribution>may be downloaded from the Maven repository</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Romain Manni-Bucau</name>
<id>rmannibucau</id>
<roles>
<role>Contributor</role>
</roles>
<timezone>+1</timezone>
</developer>
<developer>
<name>Francois Papon</name>
<id>fpapon</id>
<roles>
<role>Contributor</role>
</roles>
<timezone>+1</timezone>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/yupiik/yuc.git</connection>
<developerConnection>scm:git:https://github.com/yupiik/yuc.git</developerConnection>
<url>https://github.com/yupiik/yuc.git</url>
<tag>HEAD</tag>
</scm>

<organization>
<name>Yupiik SAS</name>
<url>https://www.yupiik.com</url>
</organization>

<inceptionYear>2023</inceptionYear>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<source>11</source>
<doclint>none</doclint>
<encoding>UTF-8</encoding>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>gh-pages</id>
<properties>
<minisite.serverId>github.com</minisite.serverId>
</properties>
<build>
<plugins>
<!-- mvn clean package -Pgh-pages -->
<plugin>
<groupId>io.yupiik.maven</groupId>
<artifactId>yupiik-tools-maven-plugin</artifactId>
<executions>
<execution>
<id>gh-pages</id>
<phase>prepare-package</phase>
<goals>
<goal>minisite</goal>
</goals>
<configuration>
<git>
<ignore>false</ignore>
<noJekyll>true</noJekyll>
<serverId>${minisite.serverId}</serverId>
<branch>refs/heads/gh-pages</branch>
<url>https://github.com/yupiik/yuc.git</url>
</git>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
21 changes: 20 additions & 1 deletion src/main/java/io/yupiik/yuc/Yuc.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright (c) 2023 - Yupiik SAS - https://www.yupiik.com
* 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
*
* http://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.
*/
package io.yupiik.yuc;

import io.yupiik.fusion.framework.api.main.Launcher;
Expand All @@ -14,6 +29,10 @@ public static void main(final String... args) {
final var implicitCommand = "default";
Launcher.main(args.length == 0 ?
new String[]{implicitCommand} :
Stream.concat(Stream.of(implicitCommand), Stream.of(args)).toArray(String[]::new));
isCommand(args[0]) ? args : Stream.concat(Stream.of(implicitCommand), Stream.of(args)).toArray(String[]::new));
}

private static boolean isCommand(final String name) {
return "help".equals(name) || "default".equals(name);
}
}

0 comments on commit dc94527

Please sign in to comment.