jtos

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

README

Copy code

jtos

jtos is a command-line application for processing json input files and generating the struct code for the chosen language. Currently, only Go is supported as a language generator.

Prerequisites

  • Go (version 1.21 or newer)

Installation

Before you can use jtos, you need to install it. The currently only installation possible is through go install:

go install github.com/EdsonHTJ/jtos/cmd/jtos@latest

Usage

Basic Usage
jtos [path/to/input/file]

With the basic usage, the input file is taken from the argument, and the output file defaults to a directory and file named after the input filename without its extension. The generator defaults to "go".

Advanced Usage
jtos --input="path/to/input/file" --out="path/to/output/file" --gen="generator_type"
  • -g, --gen string: The generator type to use. (default "go")
  • -h, --help: Help for jtos.
  • -o, --out string: Path to the output directory. (default "./")
  • -p, --package string: Name of the output package.
  • -s, --struct string: Name of the output structure.

For example, for an input file at /etc/lib/test.txt, the default output will be test/test.go.

Examples
jtos example.json
# Output will be in example/example.go
jtos --input=sample.json --out=output/path --package=samplePkg --struct=SampleStruct
# Adjusted output, package name, and struct name.

Contribution

Contributions are welcome! Please create an issue or open a pull request if you have changes or improvements.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Lib = 0

Functions

func Unmarshal

func Unmarshal(json string) (domain.Object, error)

Types

type GeneratorCode

type GeneratorCode uint8
const (
	GOLANG_GENERATOR GeneratorCode = iota
)

type ParseResponse

type ParseResponse struct {
	Output         string
	RecomendedPath string
}

func ParseJsonFile

func ParseJsonFile(packageName string, mainStruct string, json string, generatorCode GeneratorCode) (ParseResponse, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL