Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
923b0a1
chore: add fesod-cli module and implement core CLI commands
liugddx Dec 28, 2025
d381ede
1
liugddx Dec 29, 2025
095d710
chore: clean up fesod-cli scripts and add .gitattributes for line end…
liugddx Dec 29, 2025
23cb344
chore: remove some useless file
liugddx Dec 29, 2025
c901384
chore: remove some useless file
liugddx Dec 29, 2025
45a9971
chore: remove some useless file
liugddx Dec 29, 2025
7e78164
chore: remove some useless file
liugddx Dec 29, 2025
5d0cb9c
chore: remove some useless file
liugddx Dec 29, 2025
b0bc52c
chore: remove some useless file
liugddx Dec 29, 2025
8bff01e
chore: remove some useless file
liugddx Dec 29, 2025
ec39c96
chore: remove some useless file
liugddx Dec 30, 2025
a15f5de
Update fesod-cli/src/main/java/org/apache/fesod/cli/formatters/Format…
liugddx Dec 30, 2025
1438b7a
Update fesod-cli/src/main/java/org/apache/fesod/cli/core/sheet/SheetR…
liugddx Dec 30, 2025
19c3c6d
Update fesod-cli/src/main/java/org/apache/fesod/cli/commands/WriteCom…
liugddx Dec 30, 2025
f660aff
Update fesod-cli/src/main/java/org/apache/fesod/cli/FesodCli.java
liugddx Dec 30, 2025
e8867d6
Update fesod-cli/src/main/java/org/apache/fesod/cli/FesodCli.java
liugddx Dec 30, 2025
1b94d76
chore: remove some useless file
liugddx Dec 30, 2025
45e89d7
chore: remove some useless file
liugddx Dec 30, 2025
2d1cce8
Merge remote-tracking branch 'upstream/main' into feat-746
liugddx Jan 11, 2026
8cedcf9
chore: add fesod-cli module and implement core CLI commands
liugddx Jan 11, 2026
9826905
chore: remove application.properties from configuration files
liugddx Jan 11, 2026
f09f406
chore: remove application.properties from configuration files
liugddx Jan 11, 2026
2f5b0fc
chore: remove application.properties from configuration files
liugddx Jan 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
restore-keys: |
${{ runner.os }}-m2
- name: Test with Maven
run: ./mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet
run: ./mvnw clean package -B -Dmaven.test.skip=false -pl fesod-common,fesod-shaded,fesod-sheet,fesod-cli
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
Expand Down
175 changes: 175 additions & 0 deletions fesod-cli/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.fesod</groupId>
<artifactId>fesod-parent</artifactId>
<version>${revision}</version>
</parent>

<artifactId>fesod-cli</artifactId>
<packaging>jar</packaging>
<name>Apache Fesod CLI Tool</name>
<description>Command-line interface for Apache Fesod spreadsheet processing</description>

<properties>
<picocli.version>4.7.5</picocli.version>
<snakeyaml.version>2.2</snakeyaml.version>
<mainClass>org.apache.fesod.cli.FesodCli</mainClass>
</properties>

<dependencies>
<!-- Fesod Core Dependencies -->
<dependency>
<groupId>org.apache.fesod</groupId>
<artifactId>fesod-sheet</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Picocli for CLI -->
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>${picocli.version}</version>
</dependency>

<!-- JSON Processing -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<scope>compile</scope>
</dependency>

<!-- YAML Configuration -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>

<!-- CSV Support -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
</dependency>

<!-- Logging -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Maven Compiler Plugin - Picocli annotation processor -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>${picocli.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
</compilerArgs>
</configuration>
</plugin>

<!-- Maven Shade Plugin - Create Fat JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>Apache Software Foundation</Implementation-Vendor>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>

<!-- Maven Assembly Plugin - Create Distribution Package -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
84 changes: 84 additions & 0 deletions fesod-cli/src/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.

-->
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>fesod-cli-${project.version}</baseDirectory>

<fileSets>
<!-- Fat JAR -->
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>fesod-cli-${project.version}.jar</include>
</includes>
</fileSet>

<!-- Scripts -->
<fileSet>
<directory>${project.basedir}/src/main/scripts</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>fesod-cli</include>
<include>fesod-cli.bat</include>
</includes>
<fileMode>755</fileMode>
</fileSet>

<!-- Configuration -->
<fileSet>
<directory>${project.basedir}/src/main/resources</directory>
<outputDirectory>conf</outputDirectory>
<includes>
<include>logback.xml</include>
<include>default-config.yaml</include>
</includes>
</fileSet>

<!-- License files from root -->
<fileSet>
<directory>${project.basedir}/..</directory>
<outputDirectory>.</outputDirectory>
<includes>
<include>LICENSE</include>
<include>NOTICE</include>
<include>DISCLAIMER</include>
</includes>
</fileSet>

<!-- Third-party licenses -->
<fileSet>
<directory>${project.basedir}/../dist/licenses</directory>
<outputDirectory>licenses</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
98 changes: 98 additions & 0 deletions fesod-cli/src/main/java/org/apache/fesod/cli/FesodCli.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.fesod.cli;

import org.apache.fesod.cli.commands.ConvertCommand;
import org.apache.fesod.cli.commands.InfoCommand;
import org.apache.fesod.cli.commands.ReadCommand;
import org.apache.fesod.cli.commands.VersionCommand;
import org.apache.fesod.cli.commands.WriteCommand;
import org.apache.fesod.cli.exception.CliException;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Option;
import picocli.CommandLine.Spec;

@Command(
name = "fesod-cli",
mixinStandardHelpOptions = true,
version = {"Apache Fesod CLI", "Java Runtime: ${java.version}", "OS: ${os.name} ${os.arch}"},
description = "Fast and Easy spreadsheet processing from the command line",
subcommands = {
ReadCommand.class,
WriteCommand.class,
ConvertCommand.class,
InfoCommand.class,
VersionCommand.class,
CommandLine.HelpCommand.class
},
usageHelpAutoWidth = true,
footer = {
"",
"Examples:",
" fesod-cli read data.xlsx --format json",
" fesod-cli convert input.xls output.xlsx",
" fesod-cli convert input.xlsx output.csv --sheet 0",
" fesod-cli convert input.xlsx output.xlsx --sheet-name \"Sales\"",
" fesod-cli info data.xlsx",
"",
"Documentation: https://fesod.apache.org/docs/cli",
"Report bugs: https://github.com/apache/fesod/issues"
})
public class FesodCli implements Runnable {

@Spec
CommandSpec spec;

@Option(
names = {"--verbose", "-v"},
description = "Enable verbose logging")
private boolean verbose;

@Override
public void run() {
// Default: show help when no command specified
spec.commandLine().usage(spec.commandLine().getOut());
}

public static void main(String[] args) {
int exitCode = new CommandLine(new FesodCli())
.setExecutionExceptionHandler((ex, cmd, parseResult) -> {
cmd.getErr().println(cmd.getColorScheme().errorText("Error: " + ex.getMessage()));

if (ex instanceof CliException) {
CliException cliEx = (CliException) ex;
if (cliEx.getCause() != null && parseResult.hasMatchedOption("--verbose")) {
cliEx.printStackTrace(cmd.getErr());
}
return cliEx.getExitCode();
} else {
if (parseResult.hasMatchedOption("--verbose")) {
ex.printStackTrace(cmd.getErr());
}
return 1;
}
})
.execute(args);

System.exit(exitCode);
}
}
Loading
Loading