Skip to content

Commit

Permalink
Improved alias name.
Browse files Browse the repository at this point in the history
  • Loading branch information
gergo-dryrun committed Dec 9, 2024
1 parent 6819b5b commit 34e4f12
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ A collection of useful GitHub CLI aliases with integrated testing.
```
## Available Aliases

### start-work
### start-coding

Creates a new branch and PR for starting work on a ticket.

Usage:
```bash
gh start-work <JIRA_TICKET> [ISSUE_TYPE]
gh start-coding <JIRA_TICKET> [ISSUE_TYPE]
```

See [start-work documentation](aliases/start-work/README.md) for more details.
See [start-coding documentation](aliases/start-coding/README.md) for more details.

## Development

Expand Down
29 changes: 20 additions & 9 deletions aliases/start-work/README.md → aliases/start-coding/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# Start Work GitHub CLI Alias
# Start Coding GitHub CLI Alias

A GitHub CLI alias that helps streamline the process of starting work on a new task by automating branch creation and pull request setup.

## Installation

### Prerequisites

Before installing, ensure you have:
- [GitHub CLI](https://cli.github.com/) installed (`gh`)
- GitHub CLI authenticated (`gh auth login`)
- Git installed and configured

This alias is installed automatically when you run the installation script:

```bash
./scripts/install-aliases.sh
source "alias.sh"
```

2. Verify the installation:
```bash
gh alias list | grep start-coding
```

## Usage

```bash
gh start-work <JIRA_TICKET> [ISSUE_TYPE]
gh start-coding <JIRA_TICKET> [ISSUE_TYPE] [PR_TITLE]
```

### Arguments
Expand All @@ -39,19 +51,19 @@ gh start-work <JIRA_TICKET> [ISSUE_TYPE]

```bash
# Start work on a feature
gh start-work PROJ-123
gh start-coding PROJ-123

# Start work on a feature with just a PR title (uses default feat type)
gh start-work PROJ-123 "Add login functionality"
gh start-coding PROJ-123 "Add login functionality"

# Start work on a bug fix with a custom PR title
gh start-work PROJ-456 fix "Fix login button styling"
gh start-coding PROJ-456 fix "Fix login button styling"

# Start work on a refactor
gh start-work PROJ-789 refactor
gh start-coding PROJ-789 refactor

# Start work on a chore
gh start-work PROJ-101 chore
gh start-coding PROJ-101 chore
```

## What it does
Expand All @@ -70,7 +82,6 @@ When you run this command, it will:
## Prerequisites

- Git repository with an origin remote configured
- GitHub CLI installed and authenticated
- Write access to the repository

## Error Handling
Expand Down
4 changes: 2 additions & 2 deletions aliases/start-work/alias.sh → aliases/start-coding/alias.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

gh alias set --clobber start-work '!f() { \
gh alias set --clobber start-coding '!f() { \
if [ "$1" = "--help" ]; then \
echo "Usage: gh start-work <JIRA_TICKET> [ISSUE_TYPE]"; \
echo "Usage: gh start-coding <JIRA_TICKET> [ISSUE_TYPE]"; \
echo ""; \
echo "Start work on a new feature by creating a branch and PR"; \
echo ""; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ echo "Test helpers loaded successfully"

test_start_work_help() {
echo "\nTesting help command..."
echo "Running: gh start-work --help"
output=$(run_command gh start-work --help)
echo "Running: gh start-coding --help"
output=$(run_command gh start-coding --help)
status=$?

assert_equals 0 "$status" "Help command should exit with 0"
first_line=$(echo "$output" | head -n1)
assert_equals "Usage: gh start-work <JIRA_TICKET> [ISSUE_TYPE]" "$first_line" "Help message should show usage"
assert_equals "Usage: gh start-coding <JIRA_TICKET> [ISSUE_TYPE]" "$first_line" "Help message should show usage"
}

test_start_work_invalid_type() {
echo "\nTesting invalid type..."
echo "Running: gh start-work INTEGRATION_TEST-123 invalid_type"
output=$(run_command gh start-work INTEGRATION_TEST-123 invalid_type)
echo "Running: gh start-coding INTEGRATION_TEST-123 invalid_type"
output=$(run_command gh start-coding INTEGRATION_TEST-123 invalid_type)
status=$?

assert_equals 1 "$status" "Invalid type should exit with 1"
Expand All @@ -43,7 +43,7 @@ run_tests() {
return 0
fi

echo "\n=== Running start-work tests ==="
echo "\n=== Running start-coding tests ==="
echo "Verifying gh CLI installation..."
if ! command -v gh >/dev/null 2>&1; then
echo "Error: GitHub CLI (gh) is not installed"
Expand Down

0 comments on commit 34e4f12

Please sign in to comment.