curlcolor

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README ΒΆ

πŸ“– Introduction

curlor is a tool to color curl's output. It will automatically determine the highlighting style of the response body.

Thanks to the power of chroma, curlor can better support more response formats and more highlight themes.

If you find that some responses are supposed to be colored but aren't, please let me know via issue.

πŸš€ Features:

  • Keep the curl original output formatted.
  • Automatically determine the highlighting format for the response body.
  • Support more than 50 formats, such as json, yaml, html, etc.
  • Support other theme.

🎊 Preview

img.png

img.png

img.png

πŸ“Œ Roadmap

  • support package manager
  • add more formats
  • add help info for usage

🧰 Install

go install github.com/if-nil/curlor/cmd/curlor@latest

πŸ”¨οΈ Build

git clone https://github.com/if-nil/curlor
cd curlor/cmd/curlor
go build -o curlor

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func GetFormatType ΒΆ

func GetFormatType(contentType string, filename string) string

func GetUrlScheme ΒΆ

func GetUrlScheme(url string) string

func NewVerboseChannelIterator ΒΆ

func NewVerboseChannelIterator(source chan string) chroma.Iterator

func ParseAndPrintError ΒΆ

func ParseAndPrintError(mgr *Manager, errReader io.Reader) error

func ParseAndPrintOutput ΒΆ

func ParseAndPrintOutput(mgr *Manager, output io.Reader) error

func ParseResponse ΒΆ

func ParseResponse(text []byte, url string) (*http.Response, error)

func Run ΒΆ

func Run(argv []string, version string) error

func SplitHeader ΒΆ

func SplitHeader(respBF *bufio.Reader) ([]byte, error)

func TraversalSearchBool ΒΆ

func TraversalSearchBool(key string, argv []string, default2 bool) (bool, []string, error)

func TraversalSearchString ΒΆ

func TraversalSearchString(key string, argv []string, default2 string) (string, []string, error)

Types ΒΆ

type ArgType ΒΆ

type ArgType int
const (
	ArgNone ArgType = iota
	ArgBool
	ArgString
	ArgFilename
)

type ColorPrinter ΒΆ

type ColorPrinter struct {
	OutWriter io.Writer
	ErrWriter io.Writer
	Formatter string
	Theme     string
}

func (*ColorPrinter) Highlight ΒΆ

func (c *ColorPrinter) Highlight(text []byte, lexer string)

func (*ColorPrinter) Print ΒΆ

func (c *ColorPrinter) Print(text []byte)

func (*ColorPrinter) VerboseChannelFormat ΒΆ

func (c *ColorPrinter) VerboseChannelFormat(text chan string) error

type CurlParam ΒΆ

type CurlParam struct {
	// contains filtered or unexported fields
}

func (*CurlParam) SetVal ΒΆ

func (p *CurlParam) SetVal(argv []string) ([]string, error)

type CurlParameter ΒΆ

type CurlParameter map[string]*CurlParam

func ParseArgs ΒΆ

func ParseArgs(argv []string) (CurlParameter, error)

func (*CurlParameter) Get ΒΆ

func (p *CurlParameter) Get(key string) (*CurlParam, bool)

func (*CurlParameter) GetBool ΒΆ

func (p *CurlParameter) GetBool(key string) bool

func (*CurlParameter) GetString ΒΆ

func (p *CurlParameter) GetString(key string) string

type Manager ΒΆ

type Manager struct {
	CurlParameter CurlParameter
	Printer       ColorPrinter
	Debug         bool
	CurlCmd       string
	Version       bool
	Help          bool
}

func ResolveManager ΒΆ

func ResolveManager(args []string) (*Manager, []string, error)

Directories ΒΆ

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL