Commit graph

79 commits

Author SHA1 Message Date
Kynan Ware
3af535902d Add usage examples to gh gist edit command
Add a cobra Example string to the gist edit command showing common
operations: interactive selection, editing in default editor, editing a
specific file, replacing file content, adding/removing files, and
changing the description.

Closes #8943

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-17 12:38:15 -07:00
Lucas
7db532aca0
test(gist/edit): add tests for single file edit and interactive multi-file selection
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-10-30 18:50:49 +01:00
Lucas
6c497e74df
test(gist): fix failing tests 2025-10-30 06:12:15 +01:00
Lucas
42238dc365
fix(gist): prevent fetching full content for already edited files 2025-10-30 05:55:53 +01:00
Lucas
c98c435800
fix(gist): only include files that have changed in request
There was some issues when sending the full list of files, some of them would be truncated.
2025-10-30 05:49:52 +01:00
Lucas
f8651f5e44
fix(gist): fetch full content for truncated files during editing
This change makes it only fetch the raw content, when we wanna edit the specific file.
2025-10-30 05:48:34 +01:00
Lucas
b9b2654219
test(gist): add tests for editing truncated gist files
* Implement tests for editing gists that contain truncated files.
* Ensure that both single and multiple truncated files are handled correctly.
* Mock responses for retrieving full content from raw URLs for truncated files.
2025-09-20 06:55:10 +02:00
Lucas
bf272305ff
feat(gist): retrieve full content for truncated gist files
* Added logic to fetch full content for truncated files when updating a gist.
* Utilizes `shared.GetRawGistFile` to retrieve the complete content based on the `RawURL`.
2025-09-18 06:35:35 +02:00
phanium
19e1178a32
fix: gh gist edit panic when no file in a gist (#10627)
* fix: `gh gist edit` panic when no file in a gist

* fix: improve error message

Signed-off-by: Babak K. Shandiz <babakks@github.com>

---------

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Co-authored-by: Babak K. Shandiz <babakks@github.com>
2025-05-28 14:40:14 +01:00
Kynan Ware
facd0caa29 Fix: accidental whitespace in gist edit 2025-01-16 11:44:46 -07:00
Kynan Ware
5b6fd53a88 Fix: gist edit test name 2025-01-16 11:36:48 -07:00
Kynan Ware
dec46670bb Fix: gist edit/view tests var name consistency 2025-01-16 11:14:33 -07:00
Kynan Ware
a2dce589d6 Merge 'trunk' into fix/issue_10042 2025-01-16 11:06:36 -07:00
Kynan Ware
35d81e3ff5 Fix: Gist edit tests for interactivity
This changes the gist edit tests to use the positive `istty` instead of the previous inverse `nontty`, which is consistent with the way other commands are written.
2025-01-16 10:46:07 -07:00
Mateus Marquezini
c0f6eb0598 #10042: Attempt to add a new test scenario for handling error messages when TTY is unavailable 2025-01-13 11:39:48 -03:00
Mateus Marquezini
977e2326a2 #10042: Applied code review suggestions to view_test.go 2025-01-13 11:06:13 -03:00
Mateus Marquezini
24e9fed7e0 removed unnecessary space 2025-01-12 14:57:24 -03:00
Mateus Marquezini
c5d6ae6cf6
Update pkg/cmd/gist/edit/edit.go
Update pkg/cmd/gist/edit/edit.go after code review

Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-01-12 14:53:20 -03:00
Mateus Marquezini
f4f8840c3f #10042: Add error messages for 'gh gist view/edit' prompts when no TTY is detected 2025-01-09 12:07:15 -03:00
danochoa
9c65a32ef8 gist delete prompt with gist description 2025-01-08 17:56:02 -06:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
491e9e8e58
Ensure gist edit request body matches desired schema (#7635)
* Ensure gist edit request body matches desired schema

* Immediately transform gist to gistToUpdate in edit flow

* Remove maps package and change to NewFilename
2023-07-03 13:33:49 +09:00
Kousik Mitra
baba894997
Add option to remove file from gist (#7560) 2023-06-23 14:08:21 +02:00
Kousik Mitra
31209bcf89
Replace SurveyAskOne with Prompter 2023-06-05 22:48:21 +05:30
Kousik Mitra
9ccd098eb0
Add gist selector option to gist edit command 2023-06-05 22:07:04 +05:30
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
vilmibm
41385477c3 fix linting 2022-07-27 14:15:27 -05:00
vilmibm
d5334f4115 Revert "update linter checks"
This reverts commit 40ecb8c188.
2022-07-27 13:30:41 -05:00
vilmibm
40ecb8c188 update linter checks 2022-07-26 16:06:52 -05:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Sam Coe
f7710dedd2
Allow non-interactive gist file replacement (#5408) 2022-04-06 15:49:52 +02:00
nate smith
2f19fa792f maint: clean up some errors 2022-01-24 17:34:21 -06:00
nate smith
de4e37ed75 Merge remote-tracking branch 'origin/trunk' into feat/gist-edit 2022-01-24 17:34:09 -06:00
Nate Smith
f950637b0b
Merge pull request #4738 from SteadBytes/gist-edit-description
Support editing gist description
2022-01-18 09:34:22 -06:00
Mislav Marohnić
e43cb2b880 Port more legacy stubs to the new ask stubber 2022-01-14 19:34:15 +01:00
Tomohiro Nishimura
a9d397be69
Add --generate-notes flag to gh release create command. (#4467) 2021-12-08 15:20:59 +04:00
Ben Steadman
f30e76aab8 Support editing gist description
Add a --desc flag to gh gist edit to support editing gist
descriptions. This flag can be used in combination with the other gist
editing flags to edit the description whilst also adding/editing files.

Signed-off-by: Ben Steadman <steadmanben1@gmail.com>
2021-11-16 20:18:53 +00:00
tdakkota
ab668e8419
gist edit: add way to edit files from different sources
This commit adds an optional parameter to set source for editing or adding files to gist.
If parameter is equal to "-" then stdin will be used.
2021-11-01 10:28:30 +03:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Nate Smith
2fbc037658
Merge pull request #3042 from g14a/bug/gist-binary-files
Remove functionality to add, view and edit binary files in gists
2021-03-04 13:01:54 -06:00
Mislav Marohnić
e16c3124dd Disallow binary files with gist edit -a 2021-03-02 14:58:16 +01:00
Mislav Marohnić
77d9051d0e Simplify looking up binary types in gist 2021-03-02 14:53:10 +01:00
Gowtham Munukutla
973fbb0925 Disallow operating on binary files in gist 2021-03-02 14:52:44 +01:00
Mislav Marohnić
dd34cae112 Merge remote-tracking branch 'origin' into cancel-error-status 2021-03-02 13:52:07 +01:00
Mislav Marohnić
2ebdde1ddd Exit with status code "2" on user cancellation errors
This also stops printing "interrupt" after Ctrl-C is pressed.
2021-03-02 13:48:44 +01:00
Mislav Marohnić
8f96e406ac Improve error handling and avoid writing confirmation to stdout
Right now the `gist edit` command doesn't write anything to stdout, so
let's keep it that way until we want to intentionally provide some
feedback in the terminal.
2021-02-27 12:23:18 +01:00
Mislav Marohnić
406d7eee45 💅 cleanup gist edit -a feature 2021-02-27 12:07:35 +01:00
Gowtham Munukutla
7fd0634a24 rebase with trunk 2021-02-25 14:47:26 +05:30