Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git-runic script #122

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ that is appreciated by most Go programmers, see for example the following
- [Usage](#usage)
- [CLI](#cli)
- [Editor integration](#editor-integration)
- [Git integration](#git-integration)
- [Adopting Runic formatting](#adopting-runic-formatting)
- [Ignore formatting commits in git blame](#ignore-formatting-commits-in-git-blame)
- [Badge](#badge)
Expand All @@ -44,6 +45,9 @@ julia --project=@runic -e 'using Pkg; Pkg.add("Runic")'
# Install the runic shell script
curl -fsSL -o ~/.local/bin/runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/refs/heads/master/bin/runic
chmod +x ~/.local/bin/runic
# Install the git-runic shell script
curl -fsSL -o ~/.local/bin/runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/refs/heads/master/bin/git-runic
chmod +x ~/.local/bin/git-runic
```

Assuming `~/.local/bin` is in your `PATH` you can now invoke `runic`, e.g.:
Expand Down Expand Up @@ -267,9 +271,28 @@ This assumes that Runic is installed in the `@runic` shared project as suggested
(push '(julia-mode . runic) apheleia-mode-alist)
```

### Git integration

The [`git-runic`](https://github.com/fredrikekre/Runic.jl/blob/master/bin/git-runic)
script (a modified version of
[`git-clang-format`](https://github.com/llvm/llvm-project/blob/main/clang/tools/clang-format/git-clang-format))
provides a convenient way to apply Runic formatting incrementally to a code
base by limiting formatting to lines that are added or modified in each commit.
The script can be installed with the following commands (replace the two
occurences of `~/.local/bin` if needed):

```sh
# Download the script into ~/.local/bin
curl -fsSL -o ~/.local/bin/git-runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/refs/heads/master/bin/git-runic
# Make the script executable
chmod +x ~/.local/bin/git-runic
fredrikekre marked this conversation as resolved.
Show resolved Hide resolved
# Verify the installation
git runic -h
```

### Adopting Runic formatting

Here is a checklist for adopting Runic formatting in a project:
Here is a checklist for adopting Runic formatting wholesale in a project:

- Format all existing files with `runic -i <path>` and commit the changes in separate
commit. This commit can be ignored in `git blame` (see [Ignore formatting commits in git
Expand All @@ -278,6 +301,9 @@ Here is a checklist for adopting Runic formatting in a project:
future changes adhere to the formatting rules.
- Optionally add a badge to the repository README, see [Badge](#badge).

Alternatively Runic formatting can be adopted incrementally by using the
`git-runic` integration, see [Git integration](#git-integration) for details.

#### Ignore formatting commits in git blame

When setting up Runic formatting for a repository for the first time (or when upgrading to a
Expand Down
Loading
Loading