facebookarchive / augmented-traffic-control

Augmented Traffic Control: A tool to simulate network conditions
https://facebook.github.io/augmented-traffic-control
Other
4.33k stars 600 forks source link

Separate cli code from main binary entrypoints, move to cmd folder #334

Closed sheenobu closed 7 years ago

sheenobu commented 7 years ago

Separating out binary CLI logic form the main function is a common pattern for allowing derivative binaries without resorting to forks of the main.go. For example, 'github.com/facebook/augmented-traffic-control/cmd/atcd/cli' is now a reusable library that can be imported and used within a custom binary:

import (
  "github.com/facebook/augmented-traffic-control/cmd/atcd/cli"
)

func main() {
  // custom code...
  cli.Execute()
  // more custom code
}
chantra commented 7 years ago

:thumbsup: