Skip to content

Commit 6f8217d

Browse files
committed
chore: add bundled-sqlite feature + add 'h' alias for help
1 parent 1285f6e commit 6f8217d

File tree

7 files changed

+40
-12
lines changed

7 files changed

+40
-12
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
with:
2626
toolchain: ${{ matrix.toolchain }}
2727
- name: Build
28-
run: cargo build --verbose
28+
run: cargo build --verbose ${{ runner.os == 'Windows' && '--features bundled-sqlite' || '' }}
2929
- name: Run tests
30-
run: cargo test --verbose
30+
run: cargo test --verbose ${{ runner.os == 'Windows' && '--features bundled-sqlite' || '' }}
3131

3232
clippy:
3333
name: run clippy lints

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "boat-cli"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2024"
55
description = "Basic Opinionated Activity Tracker, a command line interface inspired by bartib"
66
repository = "https://github.com/coko7/boat"
@@ -26,6 +26,10 @@ toml = "1.0.7"
2626
rusqlite = "0.39.0"
2727
chrono = { version = "0.4.44", features = ["serde"] }
2828
serde_json = "1.0.149"
29-
boat-lib = "0.3.1"
29+
boat-lib = "0.3.2"
3030
tabular = { version = "0.2.0", features = ["ansi-cell"] }
3131
yansi = "1.0.1"
32+
33+
[features]
34+
default = []
35+
bundled = ["boat-lib/bundled-sqlite"]

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ cd boat-cli
3535
cargo build --release
3636
```
3737

38+
### Install with a bundled version of SQLite
39+
40+
If you are on Windows or you do not have SQLite on your system, you can install `boat` with the `bundled-sqlite` feature.
41+
This will increase the compilation time but guarantees a working out-of-the-box exprience.
42+
43+
When using cargo:
44+
```sh
45+
cargo install boat-cli --features bundled-sqlite
46+
```
47+
When building from source:
48+
```sh
49+
git clone https://github.com/coko7/boat-cli.git
50+
cd boat-cli
51+
cargo build --release --features bundled-sqlite
52+
```
53+
3854
## Usage
3955

4056
To get a feel of how `boat` can be used, you can try `boat help` to get the list of commands:
@@ -73,5 +89,6 @@ Commands:
7389
```
7490
I really wanted to have each command start with a different character so that I could assign a single-char alias to all of them.
7591
That explains why some of the commands do not use a more fitting keyword.
92+
7693
Like `stop` would have been a better command than `pause` but since it shares the same starting charcter as the `start` command, I could not use it.
7794
Maybe I will drop this in the future, let's see.

src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ pub enum Commands {
5454
/// List activities and tags
5555
#[command(alias = "l", alias = "ls")]
5656
List(ListActivityArgs),
57+
58+
// This is ONLY way I could find to use the 'h' short alias for help.
59+
#[command(alias = "h", hide = true)]
60+
HelpExtension,
5761
// Edit the raw content of activity files
5862
// #[command(alias = "e", alias = "ed")]
5963
// Edit(EditFilesArgs),

src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::{Context, Result};
22
use boat_lib::models::activity::NewActivity;
3-
use clap::Parser;
3+
use clap::{CommandFactory, Parser};
44
use log::{LevelFilter, error, info};
55
use rusqlite::Connection;
66
use std::process::ExitCode;
@@ -14,7 +14,7 @@ use crate::{
1414
Cli, CreateActivityArgs, ListActivityArgs, ModifyActivityArgs, PrintActivityArgs,
1515
SelectActivityArgs,
1616
},
17-
models::{SimpleActivity, SimpleLog},
17+
models::SimpleActivity,
1818
};
1919

2020
mod cli;
@@ -52,9 +52,15 @@ fn process_args(args: Cli) -> Result<()> {
5252
cli::Commands::Get(args) => get_current(&mut conn, args),
5353
cli::Commands::List(args) => list_activities(&mut conn, args),
5454
cli::Commands::Config {} => todo!(),
55+
cli::Commands::HelpExtension => print_help(),
5556
}
5657
}
5758

59+
fn print_help() -> Result<()> {
60+
Cli::command().print_help()?;
61+
Ok(())
62+
}
63+
5864
fn new_activity(conn: &mut Connection, args: &CreateActivityArgs) -> Result<()> {
5965
let new_activity = NewActivity {
6066
name: args.name.clone(),

src/utils.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use tabular::{Row, Table};
2-
use yansi::Paint;
3-
41
use crate::models::{SimpleActivity, SimpleLog};
52

63
pub fn convert_to_log_line(log: &SimpleLog, parent_activity: &SimpleActivity) -> Vec<String> {

0 commit comments

Comments
 (0)