mirror of
https://github.com/MontFerret/ferret.git
synced 2025-02-15 14:03:04 +02:00
Reorganized CLI
This commit is contained in:
parent
0e3fe130b1
commit
abec033649
10
Makefile
10
Makefile
@ -5,7 +5,7 @@ export GOPATH
|
||||
VERSION ?= $(shell git describe --tags --always --dirty)
|
||||
DIR_BIN = ./bin
|
||||
DIR_PKG = ./pkg
|
||||
DIR_CMD = ./cmd
|
||||
DIR_CLI = ./cli
|
||||
|
||||
default: build
|
||||
|
||||
@ -14,7 +14,7 @@ build: install vet generate test compile
|
||||
compile:
|
||||
go build -v -o ${DIR_BIN}/ferret \
|
||||
-ldflags "-X main.Version=${VERSION}" \
|
||||
${DIR_CMD}/main.go
|
||||
./main.go
|
||||
|
||||
install:
|
||||
dep ensure
|
||||
@ -30,14 +30,14 @@ doc:
|
||||
|
||||
# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
|
||||
fmt:
|
||||
go fmt ${DIR_CMD}/... ${DIR_PKG}/...
|
||||
go fmt ${DIR_CLI}/... ${DIR_PKG}/...
|
||||
|
||||
# https://github.com/golang/lint
|
||||
# go get github.com/golang/lint/golint
|
||||
lint:
|
||||
golint ${DIR_CMD}/... ${DIR_PKG}/...
|
||||
golint ${DIR_CLI}/... ${DIR_PKG}/...
|
||||
|
||||
# http://godoc.org/code.google.com/p/go.tools/cmd/vet
|
||||
# go get code.google.com/p/go.tools/cmd/vet
|
||||
vet:
|
||||
go vet ${DIR_CMD}/... ${DIR_PKG}/...
|
||||
go vet ${DIR_CLI}/... ${DIR_PKG}/...
|
12
README.md
12
README.md
@ -91,7 +91,7 @@ chrome.exe --remote-debugging-port=9222
|
||||
|
||||
If you want to play with ```fql``` and check its syntax, you can run CLI with the following commands:
|
||||
```
|
||||
go run ./cmd/main.go
|
||||
go run main.go
|
||||
```
|
||||
|
||||
```ferret``` will run in REPL mode.
|
||||
@ -112,15 +112,15 @@ Please use `Ctrl-D` to exit this program.
|
||||
If you want to execute a query stored in a file, just pass a file name:
|
||||
|
||||
```
|
||||
go run ./cmd/main.go ./docs/examples/hackernews.fql
|
||||
go run main.go ./docs/examples/hackernews.fql
|
||||
```
|
||||
|
||||
```
|
||||
cat ./docs/examples/hackernews.fql | go run ./cmd/main.go
|
||||
cat ./docs/examples/hackernews.fql | go run main.go
|
||||
```
|
||||
|
||||
```
|
||||
go run ./cmd/main.go < ./docs/examples/hackernews.fql
|
||||
go run main.go < ./docs/examples/hackernews.fql
|
||||
```
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ First, you need to make sure that you launched Chrome with ```remote-debugging-p
|
||||
Second, you need to pass the address to ```ferret``` CLI.
|
||||
|
||||
```
|
||||
go run ./cmd/main.go --cdp http://127.0.0.1:9222
|
||||
go run main.go --cdp http://127.0.0.1:9222
|
||||
```
|
||||
|
||||
**NOTE:** By default, ```ferret``` will try to use this local address as a default one, so it makes sense to explicitly pass the parameter only in case of either different port number or remote address.
|
||||
@ -141,7 +141,7 @@ go run ./cmd/main.go --cdp http://127.0.0.1:9222
|
||||
Alternatively, you can tell CLI to launch Chrome for you.
|
||||
|
||||
```shell
|
||||
go run ./cmd/main.go --cdp-launch
|
||||
go run main.go --cdp-launch
|
||||
```
|
||||
|
||||
**NOTE:** Launch command is currently broken on MacOS.
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/MontFerret/ferret/cmd/cli"
|
||||
"github.com/MontFerret/ferret/pkg/browser"
|
||||
"github.com/MontFerret/ferret/cli"
|
||||
"github.com/MontFerret/ferret/cli/browser"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"io/ioutil"
|
||||
"os"
|
Loading…
x
Reference in New Issue
Block a user