Skip to content

Commit e6b2476

Browse files
authored
Merge pull request #3 from feloy/version
feat: initialize openshell-image-builder CLI project
2 parents 5527714 + 831ff28 commit e6b2476

6 files changed

Lines changed: 264 additions & 21 deletions

File tree

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
time: "03:00"

.github/workflows/pr-check.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR Check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check:
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-24.04, macos-26, windows-2025]
12+
steps:
13+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14+
15+
- name: Install Rust toolchain
16+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1 stable
17+
with:
18+
toolchain: stable
19+
components: rustfmt, clippy
20+
21+
- name: Cache cargo registry
22+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
23+
with:
24+
path: |
25+
~/.cargo/registry
26+
~/.cargo/git
27+
target
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29+
restore-keys: ${{ runner.os }}-cargo-
30+
31+
- name: Format
32+
run: cargo fmt --check
33+
34+
- name: Clippy
35+
run: cargo clippy -- -D warnings
36+
37+
- name: Test
38+
run: cargo test

.gitignore

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
3-
debug
4-
target
5-
6-
# These are backup files generated by rustfmt
7-
**/*.rs.bk
8-
9-
# MSVC Windows builds of rustc generate these, which store debugging information
10-
*.pdb
11-
12-
# Generated by cargo mutants
13-
# Contains mutation testing data
14-
**/mutants.out*/
15-
16-
# RustRover
17-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19-
# and can be added to the global gitignore or merged into this file. For a more nuclear
20-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21-
#.idea/
1+
/target

Cargo.lock

Lines changed: 186 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "openshell-image-builder"
3+
version = "0.1.0-next"
4+
edition = "2024"
5+
6+
[dependencies]
7+
clap = { version = "4", features = ["derive"] }

src/main.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use clap::Parser;
2+
3+
#[derive(Parser)]
4+
#[command(
5+
name = "openshell-image-builder",
6+
version,
7+
about = "OpenShell image builder"
8+
)]
9+
struct Cli {}
10+
11+
fn main() {
12+
let _cli = Cli::parse();
13+
}
14+
15+
#[cfg(test)]
16+
mod tests {
17+
use super::*;
18+
use clap::CommandFactory;
19+
20+
#[test]
21+
fn version_matches_cargo_toml() {
22+
let cmd = Cli::command();
23+
assert_eq!(cmd.get_version(), Some(env!("CARGO_PKG_VERSION")));
24+
}
25+
}

0 commit comments

Comments
 (0)