feat(gist): retrieve full content for truncated gist files
* Added logic to fetch the full content of a gist file if it is marked as truncated. * Utilizes the `GetRawGistFile` function to obtain the complete content from the provided `RawURL`.
This commit is contained in:
parent
62ea060590
commit
704bb4164c
1 changed files with 10 additions and 0 deletions
|
|
@ -136,6 +136,16 @@ func viewRun(opts *ViewOptions) error {
|
|||
defer opts.IO.StopPager()
|
||||
|
||||
render := func(gf *shared.GistFile) error {
|
||||
if gf.Truncated {
|
||||
fullContent, err := shared.GetRawGistFile(client, gf.RawURL)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gf.Content = fullContent
|
||||
}
|
||||
|
||||
if shared.IsBinaryContents([]byte(gf.Content)) {
|
||||
if len(gist.Files) == 1 || opts.Filename != "" {
|
||||
return fmt.Errorf("error: file is binary")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue