Skip to content

Commit

Permalink
Merge pull request #42 from Jumpaku/feature/executable-binary
Browse files Browse the repository at this point in the history
update version to v1.1.3
  • Loading branch information
Jumpaku authored Jun 15, 2024
2 parents 35ad3dc + 2c1b88a commit aaddd20
Show file tree
Hide file tree
Showing 55 changed files with 124 additions and 185 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ go.work
cmd/tmp
*__pycache__

bin/
bin/
playground/
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ A command line tool to generate interfaces for command line tools from YAML-base
Developing console apps involves defining and parsing command line interfaces (CLIs) such as command line arguments, which consist of subcommands, options, and positional arguments.

`cyamli` is a schema-based code generator that generates APIs (Application Programming Interfaces, such as types and functions) to handle typed CLIs.
The schema of a typed CLI can be written in YAML according to the CLI schema definition ( https://github.com/Jumpaku/cyamli/blob/main/schema/cli.schema.yaml ).
The schema of a typed CLI can be written in YAML according to the JSON schema at https://github.com/Jumpaku/cyamli/blob/main/schema/cli.schema.yaml ( JSON version is also available at https://github.com/Jumpaku/cyamli/blob/main/schema/cli.schema.yaml ).


## Motivation

Expand All @@ -24,16 +25,29 @@ The schema of a typed CLI can be written in YAML according to the CLI schema def
go install github.com/Jumpaku/cyamli@latest
```


### Using Docker

```shell
docker run -i -v $(pwd):/workspace ghcr.io/jumpaku/cyamli:latest cyamli
```


### Downloading executable binary files

https://github.com/Jumpaku/cyamli/releases

Note that the downloaded executable binary file may require a security confirmation before it can be run.


### Building from source

```shell
git clone https://github.com/Jumpaku/cyamli.git
cd cyamli
go install .
```


## Usage with an example

Expand Down Expand Up @@ -75,6 +89,7 @@ subcommands:
description: names of tables to be described
```
### Generate API to parse the CLI in Go
The following command reads a schema from `cli.yaml` and writes the Go API into `cli.gen.go`.
Expand All @@ -98,6 +113,7 @@ func GetDoc(subcommand []string) string

### Assign functions to the generated API.


`NewCLI()` returns an object `cli` which represents a root command, and its descendant objects represent subcommands.
Each of them has a `FUNC` field.
A function assigned to this field will be called by `Run(cli, os.Args)`.
Expand Down Expand Up @@ -152,6 +168,7 @@ The following programming languages are currently supported:
* Python3
* Documentation in text, HTML, and Markdown


### Handling command line arguments

Command line arguments according to the following syntax can be handled by the generated API.
Expand All @@ -171,6 +188,7 @@ Command line arguments according to the following syntax can be handled by the g
- `<argument>` represents an argument, which must be a string that can be parsed as a value of the type of the argument.
- Tokens after `--` are handled as arguments even if prefixed by `-`.
### Usage of cyamli command
The documentation for `cyamli` command is provided at https://github.com/Jumpaku/cyamli/blob/main/cyamli-docs.md .
4 changes: 2 additions & 2 deletions cyamli-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<head>
<meta charset="UTF-8" >
<title>
cyamli (v1.1.2)
cyamli (v1.1.3)
</title>
</head>
<body>
<main>
<h1>
cyamli (v1.1.2)
cyamli (v1.1.3)
</h1>
<section>
<h2>
Expand Down
2 changes: 1 addition & 1 deletion cyamli-docs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cyamli (v1.1.2)
# cyamli (v1.1.3)

## cyamli

Expand Down
16 changes: 8 additions & 8 deletions cyamli/cli.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cyamli/cli.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cyamli
version: v1.1.2
version: v1.1.3
description: A command line tool to generate CLI for your app from YAML-based schema.
options:
-help:
Expand Down
31 changes: 0 additions & 31 deletions cyamli/testdata/fileio.tmp

This file was deleted.

Loading

0 comments on commit aaddd20

Please sign in to comment.