Documentation ¶
Overview ¶
Package cmd provides access to build on the walker CLI
This package makes it easy to create custom walker binaries that use their own Handler, Datastore, or Dispatcher. A crawler that uses the default for each of these requires simply:
func main() { cmd.Execute() }
To create your own binary that uses walker's flags but has its own handler:
func main() { cmd.Handler(NewMyHandler()) cmd.Execute() }
Likewise if you want to set your own Datastore and Dispatcher:
func main() { cmd.DataStore(NewMyDatastore()) cmd.Dispatcher(NewMyDatastore()) cmd.Execute() }
cmd.Execute() blocks until the program has completed (usually by being shutdown gracefully via SIGINT).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatcher ¶
func Dispatcher(d walker.Dispatcher)
Dispatcher sets the global dispatcher for this process
func ReadLinkClearOptions ¶
func ReadLinkClearOptions()
ReadLinkClearOptions allows tests to clear readLink options
Types ¶
type CommanderStreams ¶
type CommanderStreams struct { Printf func(format string, args ...interface{}) Errorf func(format string, args ...interface{}) Exit func(status int) }
CommanderStreams holds the i/o functions that the test harness can spoof. This is useful since (a) the test harness modifies the normal stdout/stderr streams, and this can cause strange behavior
with tests if we then try to modify stdout/stderr to capture.
(b) there is no good way to spoof os.Exit, short of doing what we're doing by putting a layer of indirection
into the strack trace.
func Streams ¶
func Streams(cstream CommanderStreams) CommanderStreams
Streams allows user to set global CommandStreams object