mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-19 21:10:15 +02:00
parent
3175fa52d7
commit
3b3f74c6a5
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -14,13 +13,15 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kong"
|
||||||
|
colorable "github.com/mattn/go-colorable"
|
||||||
|
isatty "github.com/mattn/go-isatty"
|
||||||
|
|
||||||
"github.com/alecthomas/chroma"
|
"github.com/alecthomas/chroma"
|
||||||
"github.com/alecthomas/chroma/formatters"
|
"github.com/alecthomas/chroma/formatters"
|
||||||
"github.com/alecthomas/chroma/formatters/html"
|
"github.com/alecthomas/chroma/formatters/html"
|
||||||
"github.com/alecthomas/chroma/lexers"
|
"github.com/alecthomas/chroma/lexers"
|
||||||
"github.com/alecthomas/chroma/styles"
|
"github.com/alecthomas/chroma/styles"
|
||||||
"github.com/mattn/go-colorable"
|
|
||||||
"github.com/mattn/go-isatty"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -63,7 +64,7 @@ command, for Go.
|
|||||||
HTMLBaseLine int `help:"Base line number." default:"1"`
|
HTMLBaseLine int `help:"Base line number." default:"1"`
|
||||||
HTMLPreventSurroundingPre bool `help:"Prevent the surrounding pre tag."`
|
HTMLPreventSurroundingPre bool `help:"Prevent the surrounding pre tag."`
|
||||||
|
|
||||||
Files []string `arg:"" help:"Files to highlight." type:"existingfile"`
|
Files []string `arg:"" optional:"" help:"Files to highlight." type:"existingfile"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ func (n *nopFlushableWriter) Flush() error { return nil }
|
|||||||
func main() {
|
func main() {
|
||||||
ctx := kong.Parse(&cli, kong.Description(description), kong.Vars{
|
ctx := kong.Parse(&cli, kong.Description(description), kong.Vars{
|
||||||
"version": fmt.Sprintf("%s-%s-%s", version, commit, date),
|
"version": fmt.Sprintf("%s-%s-%s", version, commit, date),
|
||||||
}, )
|
})
|
||||||
if cli.List {
|
if cli.List {
|
||||||
listAll()
|
listAll()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user