Debian Codegraph @

main.go

raw symbols SCIP
1 // Copyright (c) Bartłomiej Płotka @bwplotka
2 // Licensed under the Apache License 2.0.
3
4 //lint:file-ignore faillint main.go can use fmt.Print* family for error logging, when logger is not ready.
5
6 package mainscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/
7
8 import (
9 "logscip-go gomod github.com/golang/go/src go1.24.9 log/"
10 "osscip-go gomod github.com/golang/go/src go1.24.9 os/"
11
12 "github.com/bwplotka/bingo/builtinscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/builtin`/"
13
14 "github.com/spf13/cobrascip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/"
15 )
16
17 var verbosescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/verbose. bool
18 var moddirscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/moddir. string
19
20 func NewBingoCommandscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/NewBingoCommand().(logger *logscip-go gomod github.com/golang/go/src go1.24.9 log/.Loggerscip-go gomod github.com/golang/go/src go1.24.9 log/Logger#) *cobrascip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command# {
21 cmd := &cobrascip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/.Commandscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#{
22 Usescip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#Use.: "bingo",
23 Longscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#Long.: `bingo: 'go get' like, simple CLI that allows automated versioning of
24 Go package level binaries (e.g required as dev tools by your project!)
25
26 built on top of Go Modules, allowing reproducible dev environments.
27 'bingo' allows to easily maintain a separate, nested Go Module for each binary.
28
29 For detailed examples and documentation see: https://github.com/bwplotka/bingo
30 `,
31 }
32 flags := cmd.PersistentFlagsscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#PersistentFlags().()
33 flags.BoolVarPscip-go gomod github.com/spf13/pflag v1.0.10 `github.com/spf13/pflag`/FlagSet#BoolVarP().(&verbosescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/verbose., "verbose", "v", false, "Print more")
34 flags.StringVarPscip-go gomod github.com/spf13/pflag v1.0.10 `github.com/spf13/pflag`/FlagSet#StringVarP().(&moddirscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/moddir., "moddir", "m", ".bingo", "Directory where separate modules for each binary will be maintained. \n"+
35 "Feel free to commit this directory to your VCS to bond binary versions to your project code. \n"+
36 "If the directory does not exist bingo logs and assumes a fresh project.")
37 cmd.AddCommandscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#AddCommand().(NewBingoGetCommandscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/NewBingoGetCommand().(logger))
38 cmd.AddCommandscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#AddCommand().(NewBingoListCommandscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/NewBingoListCommand().(logger))
39 cmd.AddCommandscip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#AddCommand().(NewBingoVersionCommandscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/NewBingoVersionCommand().())
40 cmd.SetUsageTemplatescip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#SetUsageTemplate().(builtinscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/builtin`/.CommandHelpTemplatescip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo/builtin`/CommandHelpTemplate.)
41 return cmd
42 }
43
44 func mainscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/main().() {
45 logger := logscip-go gomod github.com/golang/go/src go1.24.9 log/.Newscip-go gomod github.com/golang/go/src go1.24.9 log/New().(osscip-go gomod github.com/golang/go/src go1.24.9 os/.Stderrscip-go gomod github.com/golang/go/src go1.24.9 os/Stderr., "", 0)
46 rootCmd := NewBingoCommandscip-go gomod github.com/bwplotka/bingo . `github.com/bwplotka/bingo`/NewBingoCommand().(logger)
47 err := rootCmd.Executescip-go gomod github.com/spf13/cobra v1.10.1 `github.com/spf13/cobra`/Command#Execute().()
48 if err != nil {
49 logger.Printlnscip-go gomod github.com/golang/go/src go1.24.9 log/Logger#Println().(err)
50 osscip-go gomod github.com/golang/go/src go1.24.9 os/.Exitscip-go gomod github.com/golang/go/src go1.24.9 os/Exit().(1)
51 }
52 }