mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-09 09:49:09 +02:00
fix: tui mode handling of remote urls (#744)
This commit is contained in:
parent
c84a03bbfd
commit
d2e04adbfe
2 changed files with 10 additions and 1 deletions
6
main.go
6
main.go
|
|
@ -327,7 +327,11 @@ func executeCLI(cmd *cobra.Command, src *source, w io.Writer) error {
|
|||
}
|
||||
return nil
|
||||
case tui || cmd.Flags().Changed("tui"):
|
||||
return runTUI(src.URL, content)
|
||||
path := ""
|
||||
if !isURL(src.URL) {
|
||||
path = src.URL
|
||||
}
|
||||
return runTUI(path, content)
|
||||
default:
|
||||
if _, err = fmt.Fprint(w, out); err != nil {
|
||||
return fmt.Errorf("unable to write to writer: %w", err)
|
||||
|
|
|
|||
5
url.go
5
url.go
|
|
@ -79,3 +79,8 @@ func gitlabReadmeURL(path string) *url.URL {
|
|||
u, _ := url.Parse(gitlabURL.String())
|
||||
return u.JoinPath(path)
|
||||
}
|
||||
|
||||
func isURL(path string) bool {
|
||||
_, err := url.ParseRequestURI(path)
|
||||
return err == nil && strings.Contains(path, "://")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue