GithubHelp home page GithubHelp logo

ghokun / convert Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 553 KB

Convert your data files

License: Apache License 2.0

Java 95.09% Shell 1.65% Gherkin 3.26%
csv json properties toml yaml graalvm jreleaser gradle java21

convert's Introduction

Convert Build

This is a data file converter that supports following files:

Install

brew install ghokun/tap/convert

# or
brew tap ghokun/tap
brew install convert

Usage

# Simple conversions
convert --input abc.csv --output abc.json
convert --input abc.yaml --output abc.properties
convert --input abc.toml --output abc.csv

# Prettify json
convert --input abc.json --output pretty-abc.json --pretty

# Minify json
convert --input pretty-abc.json --output abc.json

# Indent yaml
#
# abc:       abc:
# - item1 ->   - item1
# - item2      - item2
#
convert --input abc.yaml --output indented-abc.yaml --indent-yaml

# Minimize yaml quotes
#
# abc: "Hello world!" -> abc: Hello world!
convert --input abc.yaml --output abc-without-quotes.yaml --minimize-yaml-quotes

# Deduplicate keys
# This:
# [
#   {
#     "key1": "value1",
#     "key2": "value2"
#   },
#   {
#     "key1": "value3",
#     "key2": "value4"
#   }
# ]
#
# Becomes this:
# {
#   "keys" : [ "key1", "key2" ],
#   "values" : [ [ "value1", "value2" ], [ "value3", "value4" ] ]
# }
convert --input abc.json --output dedup-abc.json --deduplicate-keys

Purpose of another converter

I am aware that there are many file converters, even online ones, available for free. Consider this as a playground since I wanted to practice/learn the following technologies:

Development

# Switch java version (If you are using SDKMAN!)
sdk env

# Format code
./gradlew spotlessApply

# Do static analysis, compile and test
./gradlew check

# Compile the project and build a native executable
./gradlew nativeRun

# Run the native executable
./build/native/nativeCompile/convert

# Run the application with the agent on JVM
./gradlew -Pagent run

# Copy metadata into /META-INF/native-image directory
./gradlew metadataCopy --task run --dir src/main/resources/META-INF/native-image

# Build a native executable using metadata
./gradlew nativeCompile

# Run the native executable
./build/native/nativeCompile/convert

# Run JUnit tests
./gradlew nativeTest

# Run tests on JVM with the agent
./gradlew -Pagent test

# Test building a native executable using metadata
./gradlew -Pagent nativeTest

# Generate a distributable package with VERSION
./gradlew -Pversion=${VERSION} nativeCompile generatePackage

# End to end test
./gradlew e2e

TODO list

  • Basic setup (project structure, formatting, static analysis, testing)
  • Implement all possible file conversions
    • CSV needs special implementation, others are trivial
  • GraalVM setup
    • Native compilation
    • Generate/Analyze/Validate reflection configs
    • Visualize image size with GraalVM Dashboard
  • Set up JReleaser to release on:
    • GitHub
    • Homebrew
  • Build for OS / Arch combinations:
    • Darwin - x86_64
    • Darwin - aarch64 (self hosted runner)
    • Linux - x86_64
    • Linux - aarch64 (self hosted docker runner)
  • Streaming support
    • Read data from STDIN
    • Handle huge files
    • Handle partial inputs (streaming json logs ?)
  • Minify binary with UPX on supported platforms
  • Have fun

convert's People

Contributors

ghokun avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

convert's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • graalvm/setup-graalvm v1
  • crazy-max/ghaction-upx v3
.github/workflows/release.yaml
  • actions/checkout v4
  • graalvm/setup-graalvm v1
  • crazy-max/ghaction-upx v3
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/download-artifact v4
  • jreleaser/release-action v2
gradle
gradle.properties
  • com.adarshr.test-logger 4.0.0
  • com.diffplug.spotless 6.25.0
  • net.ltgt.errorprone 4.0.1
  • org.graalvm.buildtools.native 0.10.2
  • com.google.guava:guava 33.2.1-jre
  • info.picocli:picocli 4.7.6
  • info.picocli:picocli-codegen 4.7.6
  • com.fasterxml.jackson:jackson-bom 2.17.2
  • org.junit:junit-bom 5.10.3
  • org.assertj:assertj-core 3.26.3
  • io.cucumber:cucumber-bom 7.18.1
  • com.google.errorprone:error_prone_core 2.29.2
  • tech.picnic.error-prone-support:error-prone-contrib 0.17.0
  • tech.picnic.error-prone-support:refaster-runner 0.17.0
settings.gradle
build.gradle
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.9

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.