Skip to content

Commit caa6e0d

Browse files
committed
template init
1 parent 4b5ba45 commit caa6e0d

File tree

18 files changed

+87
-177
lines changed

18 files changed

+87
-177
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: rustup toolchain install stable
1818
# Preprocess Cargo.lock to ignore version fields for cache id hashing purposes:
1919

20-
- name: Prepare Cargo.lock for caching (ignore ${APP} version)
20+
- name: Prepare Cargo.lock for caching (ignore rust-cli-template version)
2121
run: |
2222
PROJECT_NAME=$(grep '^name' Cargo.toml | sed 's/name = "\(.*\)"/\1/')
2323
awk '/\[\[package\]\]/{p=0} /name = "'"${PROJECT_NAME}"'"/{p=1} p && /version = /{next} 1' Cargo.lock > Cargo.lock.no-version
@@ -88,37 +88,37 @@ jobs:
8888
- release_for: Linux-x86_64
8989
os: ubuntu-latest
9090
target: x86_64-unknown-linux-gnu
91-
bin: ${APP}
91+
bin: rust-cli-template
9292
name: Linux-x86_64
9393
command: build
9494
- release_for: Linux-aarch64
9595
os: ubuntu-latest
9696
target: aarch64-unknown-linux-gnu
97-
bin: ${APP}
97+
bin: rust-cli-template
9898
name: Linux-aarch64
9999
command: build
100100
- release_for: macOS-x86_64
101101
os: macOS-latest
102102
target: x86_64-apple-darwin
103-
bin: ${APP}
103+
bin: rust-cli-template
104104
name: Darwin-x86_64
105105
command: build
106106
- release_for: macOS-arm64
107107
os: macOS-latest
108108
target: aarch64-apple-darwin
109-
bin: ${APP}
109+
bin: rust-cli-template
110110
name: Darwin-arm64
111111
command: build
112112
# - release_for: Windows-x86_64
113113
# os: windows-latest
114114
# target: x86_64-pc-windows-msvc
115-
# bin: ${APP}.exe
115+
# bin: rust-cli-template.exe
116116
# name: Windows-x86_64
117117
# command: build
118118
# - release_for: FreeBSD-x86_64
119119
# os: ubuntu-latest
120120
# target: x86_64-unknown-freebsd
121-
# bin: ${APP}
121+
# bin: rust-cli-template
122122
# name: FreeBSD-x86_64
123123
# command: build
124124

@@ -136,7 +136,7 @@ jobs:
136136
if: startsWith(github.ref, 'refs/tags/v')
137137
with:
138138
files: |
139-
${APP}-v*.tar.gz/${APP}-v*.tar.gz
139+
rust-cli-template-v*.tar.gz/rust-cli-template-v*.tar.gz
140140
141141
publish:
142142
name: Publish crate
@@ -150,7 +150,7 @@ jobs:
150150

151151

152152
# Preprocess Cargo.lock to ignore version fields for cache id hashing purposes:
153-
- name: Prepare Cargo.lock for caching (ignore ${APP} version)
153+
- name: Prepare Cargo.lock for caching (ignore rust-cli-template version)
154154
run: |
155155
PROJECT_NAME=$(grep '^name' Cargo.toml | sed 's/name = "\(.*\)"/\1/')
156156
awk '/\[\[package\]\]/{p=0} /name = "'"${PROJECT_NAME}"'"/{p=1} p && /version = /{next} 1' Cargo.lock > /tmp/Cargo.lock.no-version
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v4
2222

2323
# Preprocess Cargo.lock to ignore version fields for cache id hashing purposes:
24-
- name: Prepare Cargo.lock for caching (ignore ${APP} version)
24+
- name: Prepare Cargo.lock for caching (ignore rust-cli-template version)
2525
run: |
2626
PROJECT_NAME=$(grep '^name' Cargo.toml | sed 's/name = "\(.*\)"/\1/')
2727
awk '/\[\[package\]\]/{p=0} /name = "'"${PROJECT_NAME}"'"/{p=1} p && /version = /{next} 1' Cargo.lock > Cargo.lock.no-version
File renamed without changes.
File renamed without changes.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[package]
2-
name = "${APP}"
3-
description = "${APP} is a CLI tool"
2+
name = "rust-cli-template"
3+
description = "rust-cli-template is a CLI tool"
44
version = "0.1.0"
55
edition = "2021"
6-
repository = "https://github.com/${GIT_USERNAME}/${APP}"
7-
homepage = "https://github.com/${GIT_USERNAME}/${APP}"
6+
repository = "https://github.com/EnigmaCurry/rust-cli-template"
7+
homepage = "https://github.com/EnigmaCurry/rust-cli-template"
88
license = "MIT"
99
keywords = []
1010
categories = ["command-line-utilities"]
1111
readme = "README.md"
12-
documentation = "https://docs.rs/${APP}"
12+
documentation = "https://docs.rs/rust-cli-template"
1313

1414
[lints.rust]
1515
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] }
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ rustup-init ## just press enter when prompted for default selection
2020
## Clone source repository
2121

2222
```
23-
git clone git@github.com:${GIT_USERNAME}/${APP}.git \
24-
~/git/vendor/${GIT_USERNAME}/${APP}
25-
cd ~/git/vendor/${GIT_USERNAME}/${APP}
23+
git clone git@github.com:EnigmaCurry/rust-cli-template.git \
24+
~/git/vendor/EnigmaCurry/rust-cli-template
25+
cd ~/git/vendor/EnigmaCurry/rust-cli-template
2626
```
2727

2828
## Install development dependencies
@@ -32,7 +32,7 @@ cargo install just
3232
just deps
3333
```
3434

35-
## Build and run development ${APP}
35+
## Build and run development rust-cli-template
3636

3737
```
3838
just run help
@@ -49,18 +49,18 @@ just build --release
4949

5050
```
5151
## Add this to ~/.bashrc or equivalent:
52-
alias ${APP}='just -f ~/git/vendor/${GIT_USERNAME}/${APP}/Justfile run'
53-
alias h=${APP}
52+
alias rust-cli-template='just -f ~/git/vendor/EnigmaCurry/rust-cli-template/Justfile run'
53+
alias h=rust-cli-template
5454
```
5555

56-
Now you can run `${APP}`, or simply `h`, from any directory, with
56+
Now you can run `rust-cli-template`, or simply `h`, from any directory, with
5757
any arguments, and it will automatically rebuild from source, and then
5858
run it with those args.
5959

6060
## Testing
6161

6262
This project has incomplete testing. [See the latest coverage
63-
report](https://${GIT_USERNAME}.github.io/${APP}/coverage/master/).
63+
report](https://EnigmaCurry.github.io/rust-cli-template/coverage/master/).
6464

6565
## Run tests
6666

File renamed without changes.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2024 EnigmaCurry
1+
Copyright 2025 EnigmaCurry
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,64 @@
11
# rust-cli-template
22

3-
This is my Rust template for new CLI apps.
4-
5-
## Features
6-
7-
* [Just](https://github.com/casey/just) enabled project build targets.
8-
* [Clap](https://docs.rs/clap/latest/clap/) CLI argument parser.
9-
* Bash / Fish / Zsh shell (tab)
10-
[completion](https://docs.rs/clap_complete/latest/clap_complete/).
11-
* GitHub actions for tests and releases.
12-
* Test coverage report published to GitHub pages.
13-
* Publishing to crates.io.
14-
15-
## Use this template
16-
17-
* [Create a new repository using this template](https://github.com/new?template_name=rust-cli-template&template_owner=EnigmaCurry).
18-
* The `Repository name` you choose will also be used as your app name.
19-
* Go to the repository `Settings` page:
20-
* Find `Actions`.
21-
* Find `General`.
22-
* Find `Workflow Permissions`.
23-
* Set `Read and Write permissions`.
24-
* Click `Save`.
25-
* Clone your new repository to your workstation.
26-
27-
## Render the template
28-
29-
```
30-
./setup.sh
31-
```
32-
33-
This will render the template into the project root and then
34-
self-destruct this README.md and the template.
3+
[![Crates.io](https://img.shields.io/crates/v/rust-cli-template?color=blue
4+
)](https://crates.io/crates/rust-cli-template)
5+
[![Coverage](https://img.shields.io/badge/Coverage-Report-purple)](https://EnigmaCurry.github.io/rust-cli-template/coverage/master/)
6+
7+
8+
## Install
9+
10+
[Download the latest release for your platform.](https://github.com/EnigmaCurry/rust-cli-template/releases)
11+
12+
Or install via cargo ([crates.io/crates/rust-cli-template](https://crates.io/crates/rust-cli-template)):
13+
14+
```
15+
cargo install rust-cli-template
16+
```
17+
18+
### Tab completion
19+
20+
To install tab completion support, put this in your `~/.bashrc` (assuming you use Bash):
21+
22+
```
23+
### Bash completion for rust-cli-template (Put this in ~/.bashrc)
24+
source <(rust-cli-template completions bash)
25+
```
26+
27+
If you don't like to type out the full name `rust-cli-template`, you can make
28+
a shorter alias (`h`), as well as enable tab completion for the alias
29+
(`h`):
30+
31+
```
32+
### Alias rust-cli-template as h (Put this in ~/.bashrc):
33+
alias h=rust-cli-template
34+
complete -F _rust-cli-template -o bashdefault -o default h
35+
```
36+
37+
Completion for Zsh and/or Fish has also been implemented, but the
38+
author has not tested this:
39+
40+
```
41+
### Zsh completion for rust-cli-template (Put this in ~/.zshrc):
42+
autoload -U compinit; compinit; source <(rust-cli-template completions zsh)
43+
44+
### Fish completion for rust-cli-template (Put this in ~/.config/fish/config.fish):
45+
rust-cli-template completions fish | source
46+
```
47+
48+
## Usage
49+
50+
```
51+
$ rust-cli-template
52+
53+
Usage: rust-cli-template [OPTIONS] [COMMAND]
54+
55+
Commands:
56+
57+
Options:
58+
-h, --help Print help
59+
-V, --version Print version
60+
```
61+
62+
## Development
63+
64+
See [DEVELOPMENT.md](DEVELOPMENT.md)
File renamed without changes.

0 commit comments

Comments
 (0)