Skip to content

Commit

Permalink
Add installation and usage instructions to README
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jul 5, 2024
1 parent 9e00683 commit e669bc0
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,71 @@

*A code formatter with rules set in stone.*

## Installation

```julia
using Pkg
Pkg.add("Runic")
```

## Usage

The main interface to Runic is the command line interface (CLI) through the `main` function
invoked with the `-m` flag. See the output of `julia -m Runic --help` for details:

> [!NOTE]
> The `-m` command line flag is only available in Julia 1.12 and later. In earlier versions
> you have to invoke the `main` function explicitly, for example:
> ```sh
> julia -e 'using Runic; exit(Runic.main(ARGS))' -- <args>
> ```
```sh
$ julia-master -m Runic --help
NAME
Runic.main - format Julia source code
SYNOPSIS
julia -m Runic [<options>] <path>...
DESCRIPTION
`Runic.main` (typically invoked as `julia -m Runic`) formats Julia source
code using the Runic.jl formatter.
OPTIONS
<path>...
Input path(s) (files and/or directories) to process. For directories,
all files (recursively) with the '*.jl' suffix are used as input files.
If path is `-` input is read from stdin.
-c, --check
Do not write output and exit with a non-zero code if the input is not
formatted correctly.
-d, --diff
Print the diff between the input and formatted output to stderr.
Requires `git` or `diff` to be installed.
--fail-fast
Exit immediately after the first error. Only applicable when formatting
multiple files in the same invocation.
--help
Print this message.
-i, --inplace
Edit files in place. This option is required when passing multiple input
paths.
-o, --output <file>
Output file to write formatted code to. If the specified file is `-`
output is written to stdout. This option can not be used together with
multiple input paths.
```
In addition to the CLI there is also the two function `Runic.format_file` and
`Runic.format_string`. See their respective docstrings for details.
## Formatting specification
This is a list of the rules and formatting transformations performed by Runic:
Expand Down

0 comments on commit e669bc0

Please sign in to comment.