GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — codeql-action-sync-tool/cmd/root.go at main · github/codeql-action-sync-tool

Expand file tree

/

root.go

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
77 lines (61 loc) · 1.78 KB
/

root.go

Copy path

File metadata and controls

77 lines (61 loc) · 1.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package cmd
import (
"context"
"crypto/tls"
"net/http"
"os"
"path"
"path/filepath"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "codeql-action-sync",
Short: "A tool for syncing the CodeQL Action from GitHub.com to GitHub Enterprise Server.",
SilenceErrors: true,
SilenceUsage: true,
}
type rootFlagFields struct {
cacheDir string
insecure bool
}
var rootFlags = rootFlagFields{}
var SilentErr = errors.New("SilentErr")
func (f *rootFlagFields) Init(cmd *cobra.Command) error {
executablePath, err := os.Executable()
if err != nil {
return errors.Wrap(err, "Error finding own executable path.")
}
executableDirectoryPath := filepath.Dir(executablePath)
defaultCacheDir := path.Join(executableDirectoryPath, "cache")
cmd.PersistentFlags().StringVar(&f.cacheDir, "cache-dir", defaultCacheDir, "The path to a local directory to cache the Action in.")
cmd.PersistentFlags().BoolVar(&f.insecure, "insecure", false, "Allow insecure server connections when using TLS")
cmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
if f.insecure {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
}
cmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
cmd.PrintErrln(err)
cmd.PrintErrln()
cmd.PrintErr(cmd.UsageString())
return SilentErr
})
return nil
}
func Execute(ctx context.Context) error {
err := rootFlags.Init(rootCmd)
if err != nil {
return err
}
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(licensesCmd)
rootCmd.AddCommand(pullCmd)
pullFlags.Init(pullCmd)
rootCmd.AddCommand(pushCmd)
pushFlags.Init(pushCmd)
rootCmd.AddCommand(syncCmd)
pullFlags.Init(syncCmd)
pushFlags.Init(syncCmd)
return rootCmd.ExecuteContext(ctx)
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.