Skip to content

Commit fb048ca

Browse files
committed
fix(cli): Readme, changelog and pipeline nits
1 parent 690b7cb commit fb048ca

4 files changed

Lines changed: 71 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
update-tap:
5959
needs: upload
6060
runs-on: ubuntu-latest
61+
if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
6162
steps:
6263
- name: Update Homebrew tap
6364
env:
@@ -70,25 +71,25 @@ jobs:
7071
SHA_X86_64=$(curl -sL "$BASE_URL/dualentry-macos-x86_64" | shasum -a 256 | cut -d' ' -f1)
7172
SHA_LINUX=$(curl -sL "$BASE_URL/dualentry-linux-x86_64" | shasum -a 256 | cut -d' ' -f1)
7273
73-
cat > /tmp/dualentry.rb << FORMULA
74+
cat > /tmp/dualentry.rb <<'FORMULA'
7475
class Dualentry < Formula
7576
desc "DualEntry accounting CLI"
76-
homepage "https://github.com/${{ github.repository }}"
77-
version "$VERSION"
77+
homepage "https://github.com/dualentry/dualentry-cli"
78+
version "VERSION_PLACEHOLDER"
7879
7980
on_macos do
8081
if Hardware::CPU.arm?
81-
url "$BASE_URL/dualentry-macos-arm64"
82-
sha256 "$SHA_ARM64"
82+
url "URL_PLACEHOLDER/dualentry-macos-arm64"
83+
sha256 "SHA_ARM64_PLACEHOLDER"
8384
else
84-
url "$BASE_URL/dualentry-macos-x86_64"
85-
sha256 "$SHA_X86_64"
85+
url "URL_PLACEHOLDER/dualentry-macos-x86_64"
86+
sha256 "SHA_X86_64_PLACEHOLDER"
8687
end
8788
end
8889
8990
on_linux do
90-
url "$BASE_URL/dualentry-linux-x86_64"
91-
sha256 "$SHA_LINUX"
91+
url "URL_PLACEHOLDER/dualentry-linux-x86_64"
92+
sha256 "SHA_LINUX_PLACEHOLDER"
9293
end
9394
9495
def install
@@ -102,6 +103,14 @@ jobs:
102103
end
103104
FORMULA
104105
106+
# Substitute placeholders and strip leading whitespace
107+
sed -i "s|VERSION_PLACEHOLDER|$VERSION|g" /tmp/dualentry.rb
108+
sed -i "s|URL_PLACEHOLDER|$BASE_URL|g" /tmp/dualentry.rb
109+
sed -i "s|SHA_ARM64_PLACEHOLDER|$SHA_ARM64|g" /tmp/dualentry.rb
110+
sed -i "s|SHA_X86_64_PLACEHOLDER|$SHA_X86_64|g" /tmp/dualentry.rb
111+
sed -i "s|SHA_LINUX_PLACEHOLDER|$SHA_LINUX|g" /tmp/dualentry.rb
112+
sed -i 's/^ //' /tmp/dualentry.rb
113+
105114
git clone "https://x-access-token:${TAP_TOKEN}@github.com/dualentry/homebrew-tap.git" /tmp/tap
106115
mkdir -p /tmp/tap/Formula
107116
cp /tmp/dualentry.rb /tmp/tap/Formula/dualentry.rb

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
- Table and JSON output formats
88
- Pagination, search, and date/status filtering
99
- Homebrew tap and install script distribution
10-
- Auto-update checker

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ The DualEntry CLI brings the full power of the DualEntry API to your terminal. C
1515

1616
### Install
1717

18+
```bash
19+
brew install dualentry/tap/dualentry
20+
```
21+
22+
Or with uv:
23+
1824
```bash
1925
uv tool install git+https://github.com/dualentry/dualentry-cli.git
2026
```
2127

28+
Or via the install script:
29+
30+
```bash
31+
curl -fsSL https://raw.githubusercontent.com/dualentry/dualentry-cli/main/install.sh | sh
32+
```
33+
2234
### Authenticate
2335

2436
```bash
@@ -84,14 +96,16 @@ dualentry invoices list --all
8496
## Configuration
8597

8698
```bash
87-
# View current settings
8899
dualentry config show
89-
90-
# Switch environments
91-
dualentry config set-env dev # Development
92-
dualentry config set-env prod # Production
93100
```
94101

102+
**Environment variables** (override config file):
103+
104+
| Variable | Description |
105+
|----------|-------------|
106+
| `DUALENTRY_API_URL` | API base URL (overrides config) |
107+
| `X_API_KEY` | API key (skips OAuth) |
108+
95109
## Requirements
96110

97111
- Python 3.11+
@@ -103,6 +117,34 @@ dualentry config set-env prod # Production
103117
uv tool upgrade dualentry-cli
104118
```
105119

120+
## Development
121+
122+
### Setup
123+
124+
```bash
125+
uv sync --dev
126+
uv run pre-commit install
127+
```
128+
129+
### Linting
130+
131+
```bash
132+
uv run ruff check .
133+
uv run ruff format --check .
134+
```
135+
136+
### Tests
137+
138+
```bash
139+
uv run pytest
140+
```
141+
142+
With coverage:
143+
144+
```bash
145+
uv run pytest --cov=dualentry_cli --cov-report=term-missing
146+
```
147+
106148
## Documentation
107149

108150
- [API Reference](https://docs.dualentry.com/api)

install.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,27 @@ if [ "$OS" = "linux" ] && [ "$ARCH" = "arm64" ]; then
3030
fi
3131

3232
echo "Detecting latest release..."
33-
LATEST=$(curl -sI "https://github.com/${REPO}/releases/latest" | grep -i "^location:" | sed 's/.*tag\///' | tr -d '\r')
33+
LATEST=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed 's/.*: "//;s/".*//')
3434

3535
if [ -z "$LATEST" ]; then
3636
echo "Failed to detect latest release." >&2
3737
exit 1
3838
fi
3939

4040
URL="https://github.com/${REPO}/releases/download/${LATEST}/dualentry-${TARGET}"
41+
TMPFILE=$(mktemp)
4142

4243
echo "Downloading dualentry ${LATEST} for ${TARGET}..."
43-
curl -fSL "$URL" -o /tmp/dualentry
44+
curl -fSL "$URL" -o "$TMPFILE"
4445

45-
chmod +x /tmp/dualentry
46+
chmod +x "$TMPFILE"
4647
mkdir -p "$INSTALL_DIR"
4748

4849
if [ -w "$INSTALL_DIR" ]; then
49-
mv /tmp/dualentry "$INSTALL_DIR/dualentry"
50+
mv "$TMPFILE" "$INSTALL_DIR/dualentry"
5051
else
5152
echo "Installing to ${INSTALL_DIR} (requires sudo)..."
52-
sudo mv /tmp/dualentry "$INSTALL_DIR/dualentry"
53+
sudo mv "$TMPFILE" "$INSTALL_DIR/dualentry"
5354
fi
5455

5556
echo "Installed dualentry to ${INSTALL_DIR}/dualentry"

0 commit comments

Comments
 (0)