Skip to content
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
27 changes: 18 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
update-tap:
needs: upload
runs-on: ubuntu-latest
if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
steps:
- name: Update Homebrew tap
env:
Expand All @@ -70,25 +71,25 @@ jobs:
SHA_X86_64=$(curl -sL "$BASE_URL/dualentry-macos-x86_64" | shasum -a 256 | cut -d' ' -f1)
SHA_LINUX=$(curl -sL "$BASE_URL/dualentry-linux-x86_64" | shasum -a 256 | cut -d' ' -f1)

cat > /tmp/dualentry.rb << FORMULA
cat > /tmp/dualentry.rb <<'FORMULA'
class Dualentry < Formula
desc "DualEntry accounting CLI"
homepage "https://github.com/${{ github.repository }}"
version "$VERSION"
homepage "https://github.com/dualentry/dualentry-cli"
version "VERSION_PLACEHOLDER"

on_macos do
if Hardware::CPU.arm?
url "$BASE_URL/dualentry-macos-arm64"
sha256 "$SHA_ARM64"
url "URL_PLACEHOLDER/dualentry-macos-arm64"
sha256 "SHA_ARM64_PLACEHOLDER"
else
url "$BASE_URL/dualentry-macos-x86_64"
sha256 "$SHA_X86_64"
url "URL_PLACEHOLDER/dualentry-macos-x86_64"
sha256 "SHA_X86_64_PLACEHOLDER"
end
end

on_linux do
url "$BASE_URL/dualentry-linux-x86_64"
sha256 "$SHA_LINUX"
url "URL_PLACEHOLDER/dualentry-linux-x86_64"
sha256 "SHA_LINUX_PLACEHOLDER"
end

def install
Expand All @@ -102,6 +103,14 @@ jobs:
end
FORMULA

# Substitute placeholders and strip leading whitespace
sed -i "s|VERSION_PLACEHOLDER|$VERSION|g" /tmp/dualentry.rb
sed -i "s|URL_PLACEHOLDER|$BASE_URL|g" /tmp/dualentry.rb
sed -i "s|SHA_ARM64_PLACEHOLDER|$SHA_ARM64|g" /tmp/dualentry.rb
sed -i "s|SHA_X86_64_PLACEHOLDER|$SHA_X86_64|g" /tmp/dualentry.rb
sed -i "s|SHA_LINUX_PLACEHOLDER|$SHA_LINUX|g" /tmp/dualentry.rb
sed -i 's/^ //' /tmp/dualentry.rb

git clone "https://x-access-token:${TAP_TOKEN}@github.com/dualentry/homebrew-tap.git" /tmp/tap
mkdir -p /tmp/tap/Formula
cp /tmp/dualentry.rb /tmp/tap/Formula/dualentry.rb
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
- Table and JSON output formats
- Pagination, search, and date/status filtering
- Homebrew tap and install script distribution
- Auto-update checker
52 changes: 47 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,22 @@ The DualEntry CLI brings the full power of the DualEntry API to your terminal. C

### Install

```bash
brew install dualentry/tap/dualentry
```

Or with uv:

```bash
uv tool install git+https://github.com/dualentry/dualentry-cli.git
```

Or via the install script:

```bash
curl -fsSL https://raw.githubusercontent.com/dualentry/dualentry-cli/main/install.sh | sh
```

### Authenticate

```bash
Expand Down Expand Up @@ -84,14 +96,16 @@ dualentry invoices list --all
## Configuration

```bash
# View current settings
dualentry config show

# Switch environments
dualentry config set-env dev # Development
dualentry config set-env prod # Production
```

**Environment variables** (override config file):

| Variable | Description |
|----------|-------------|
| `DUALENTRY_API_URL` | API base URL (overrides config) |
| `X_API_KEY` | API key (skips OAuth) |

## Requirements

- Python 3.11+
Expand All @@ -103,6 +117,34 @@ dualentry config set-env prod # Production
uv tool upgrade dualentry-cli
```

## Development

### Setup

```bash
uv sync --dev
uv run pre-commit install
```

### Linting

```bash
uv run ruff check .
uv run ruff format --check .
```

### Tests

```bash
uv run pytest
```

With coverage:

```bash
uv run pytest --cov=dualentry_cli --cov-report=term-missing
```

## Documentation

- [API Reference](https://docs.dualentry.com/api)
Expand Down
11 changes: 6 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ if [ "$OS" = "linux" ] && [ "$ARCH" = "arm64" ]; then
fi

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

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

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

echo "Downloading dualentry ${LATEST} for ${TARGET}..."
curl -fSL "$URL" -o /tmp/dualentry
curl -fSL "$URL" -o "$TMPFILE"

chmod +x /tmp/dualentry
chmod +x "$TMPFILE"
mkdir -p "$INSTALL_DIR"

if [ -w "$INSTALL_DIR" ]; then
mv /tmp/dualentry "$INSTALL_DIR/dualentry"
mv "$TMPFILE" "$INSTALL_DIR/dualentry"
else
echo "Installing to ${INSTALL_DIR} (requires sudo)..."
sudo mv /tmp/dualentry "$INSTALL_DIR/dualentry"
sudo mv "$TMPFILE" "$INSTALL_DIR/dualentry"
fi

echo "Installed dualentry to ${INSTALL_DIR}/dualentry"
Expand Down
Loading