mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-27 08:44:41 +01:00
Add -s, -d, -h
This commit is contained in:
parent
11e8e4c94a
commit
a599bbdb6b
16
README.md
16
README.md
@ -84,7 +84,7 @@ This is currently about 10x slower than using the embedded engine, but still 5x
|
||||
|
||||
Neither the embedded Liquid server nor the Liquid Template Server implements very many Jekyll Liquid filters or tags. I'm adding to these as necessary to support my own sites.
|
||||
|
||||
## Develop
|
||||
## Contributing
|
||||
|
||||
Install package dependencies and development tools:
|
||||
|
||||
@ -92,23 +92,23 @@ Install package dependencies and development tools:
|
||||
make setup
|
||||
```
|
||||
|
||||
Test:
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
make test
|
||||
make lint
|
||||
gojekyll render index.md # render a file to stdout
|
||||
gojekyll render / # render a URL to stdout
|
||||
gojekyll variables / # print a file or URL's variables
|
||||
gojekyll -s path/to/site render index.md # render a file to stdout
|
||||
gojekyll -s path/to/site render / # render a URL to stdout
|
||||
gojekyll -s path/to/site variables / # print a file or URL's variables
|
||||
./scripts/coverage && go tool cover -html=coverage.out
|
||||
```
|
||||
|
||||
`./scripts/gojekyll` is an alternative to the `gojekyll` executable, that uses `go run` each time it's invoked.
|
||||
|
||||
Profiling:
|
||||
### Profiling
|
||||
|
||||
```bash
|
||||
gojekyll --remote-liquid profile
|
||||
gojekyll -s path/to/site profile
|
||||
go tool pprof gojekyll gojekyll.prof
|
||||
```
|
||||
|
||||
@ -128,7 +128,7 @@ The gopher image in the test directory is from [Wikimedia Commons](https://commo
|
||||
|
||||
[Jekyll](https://jekyllrb.com), of course.
|
||||
|
||||
This project is a clean-room implementation of Jekyll, based solely on Jekyll's documentation and testing a few sites.
|
||||
This project is a clean-room implementation of Jekyll, based solely on Jekyll's documentation and testing it against a few sites. Hopefully this can pay off in contributing towards Jekyll's documentation.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -17,13 +17,15 @@ var (
|
||||
useRemoteLiquidEngine bool
|
||||
)
|
||||
|
||||
const defaultDestination = "DEFAULT: ./_"
|
||||
|
||||
var (
|
||||
app = kingpin.New("gojekyll", "a (maybe someday) Jekyll-compatible blog generator in Go")
|
||||
source = app.Flag("source", "Source directory").Default(".").String()
|
||||
destination = app.Flag("destination", "Destination directory").Default("").String()
|
||||
source = app.Flag("source", "Source directory").Short('s').Default(".").String()
|
||||
destination = app.Flag("destination", "Destination directory").Short('d').Default(defaultDestination).String()
|
||||
|
||||
serve = app.Command("serve", "Serve your site locally").Alias("server").Alias("s")
|
||||
open = app.Flag("open-url", "Launch your site in a browser").Short('o').Bool()
|
||||
open = serve.Flag("open-url", "Launch your site in a browser").Short('o').Bool()
|
||||
|
||||
build = app.Command("build", "Build your site").Alias("b")
|
||||
|
||||
@ -62,10 +64,12 @@ func printPathSetting(label string, name string) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
app.HelpFlag.Short('h')
|
||||
cmd := kingpin.MustParse(app.Parse(os.Args[1:]))
|
||||
if err := run(cmd); err != nil {
|
||||
app.FatalIfError(err, "")
|
||||
}
|
||||
|
||||
}
|
||||
func run(cmd string) error {
|
||||
site, err := loadSite(*source, *destination)
|
||||
@ -97,7 +101,7 @@ func loadSite(source, destination string) (*sites.Site, error) {
|
||||
return nil, err
|
||||
}
|
||||
site.UseRemoteLiquidEngine = useRemoteLiquidEngine
|
||||
if destination != "" {
|
||||
if destination != "" && destination != defaultDestination {
|
||||
site.Destination = destination
|
||||
}
|
||||
if site.ConfigFile != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user