mirror of
https://github.com/beego/bee.git
synced 2024-11-25 20:10:55 +00:00
Merge pull request #335 from sergeylanzman/parse-all-package-only-if-docs-generate
Parse all packages only if docs generate
This commit is contained in:
commit
0b6212575d
18
bee.go
18
bee.go
@ -12,7 +12,7 @@
|
|||||||
// License for the specific language governing permissions and limitations
|
// License for the specific language governing permissions and limitations
|
||||||
// under the License.
|
// under the License.
|
||||||
|
|
||||||
// Bee is a tool for developling applications based on beego framework.
|
// Bee is a tool for developing applications based on beego framework.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -89,7 +89,7 @@ func (c *Command) Usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Runnable reports whether the command can be run; otherwise
|
// Runnable reports whether the command can be run; otherwise
|
||||||
// it is a documentation pseudo-command such as importpath.
|
// it is a documentation pseudo-command such as import path.
|
||||||
func (c *Command) Runnable() bool {
|
func (c *Command) Runnable() bool {
|
||||||
return c.Run != nil
|
return c.Run != nil
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ func main() {
|
|||||||
|
|
||||||
// Check if current directory is inside the GOPATH,
|
// Check if current directory is inside the GOPATH,
|
||||||
// if so parse the packages inside it.
|
// if so parse the packages inside it.
|
||||||
if strings.Contains(currentpath, GetGOPATHs()[0]+"/src") {
|
if strings.Contains(currentpath, GetGOPATHs()[0]+"/src") && isGenerateDocs(cmd.Name(), args) {
|
||||||
parsePackagesFromDir(currentpath)
|
parsePackagesFromDir(currentpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +176,18 @@ func main() {
|
|||||||
printErrorAndExit("Unknown subcommand")
|
printErrorAndExit("Unknown subcommand")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isGenerateDocs(name string, args []string) bool {
|
||||||
|
if name != "generate" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, a := range args {
|
||||||
|
if a == "docs" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var usageTemplate = `Bee is a Fast and Flexible tool for managing your Beego Web Application.
|
var usageTemplate = `Bee is a Fast and Flexible tool for managing your Beego Web Application.
|
||||||
|
|
||||||
{{"USAGE" | headline}}
|
{{"USAGE" | headline}}
|
||||||
|
Loading…
Reference in New Issue
Block a user