Skip to content

Commit 2210385

Browse files
committed
Improve README usage docs with auto-detection, dump mode, and line number details
1 parent 081d049 commit 2210385

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,50 @@ claude plugin update glab-discussion@fprochazka-glab-discussion
3131

3232
## Usage
3333

34-
All subcommands accept `--mr-url` or `--hostname`/`--project`/`--mr-iid` to identify the merge request.
34+
By default, the MR is auto-detected from the current git branch (via `glab mr view`). Override with `--mr-url` or `--hostname`/`--project`/`--mr-iid`.
3535

3636
### read
3737

38-
Read and display MR discussions.
38+
Read MR discussions. Prints to stdout by default, or writes per-thread files with `--dump`. In non-interactive environments (AI agents, piped output), `--dump` is the default.
3939

4040
```bash
41-
glab-discussion read --mr-url https://gitlab.com/group/project/-/merge_requests/123
42-
glab-discussion read --dump # structured data output
43-
glab-discussion read --dump --full # force full rewrite
41+
glab-discussion read # auto-detect MR from git branch
42+
glab-discussion read --dump # one file per thread, incrementally updated
43+
glab-discussion read --dump --full # clear and rewrite all files
44+
glab-discussion read --no-dump # force stdout even in non-interactive mode
4445
```
4546

4647
### write
4748

48-
Create a new discussion or reply to an existing one.
49+
Create a new discussion, reply to a thread, or add an inline diff note.
4950

5051
```bash
51-
glab-discussion write --body "Comment text" --mr-url ...
52-
glab-discussion write --body "Reply" --reply-to DISCUSSION_ID --mr-url ...
53-
glab-discussion write --body "Diff note" --file path/to/file.py --new-line 42 --mr-url ...
54-
echo "From stdin" | glab-discussion write --body - --mr-url ...
52+
glab-discussion write --body "Comment text"
53+
glab-discussion write --reply-to DISCUSSION_ID --body "Reply"
54+
glab-discussion write --file path/to/file.py --new-line 42 --body "Issue here"
55+
glab-discussion write --file path/to/file.py --old-line 10 --body "Was wrong"
56+
echo "From stdin" | glab-discussion write --body -
5557
```
5658

59+
`--new-line` corresponds to the file on the MR source branch — if the branch is checked out locally, local file line numbers match directly. `--old-line` refers to the target branch version.
60+
5761
### diff
5862

59-
Show MR diff information.
63+
Show the MR diff annotated with old/new line numbers, so you know which line numbers to use with `write --new-line` or `--old-line`.
6064

6165
```bash
62-
glab-discussion diff --mr-url ...
63-
glab-discussion diff --file path/to/file.py --mr-url ...
64-
glab-discussion diff --version 3 --mr-url ...
66+
glab-discussion diff
67+
glab-discussion diff --file path/to/file.py
68+
glab-discussion diff --version 3
6569
```
6670

6771
### resolve
6872

6973
Resolve or unresolve a discussion.
7074

7175
```bash
72-
glab-discussion resolve DISCUSSION_ID --mr-url ...
73-
glab-discussion resolve DISCUSSION_ID --unresolve --mr-url ...
76+
glab-discussion resolve DISCUSSION_ID
77+
glab-discussion resolve DISCUSSION_ID --unresolve
7478
```
7579

7680
## Requirements

0 commit comments

Comments
 (0)