Skip to content

Commit

Permalink
use RootCmd.PersistentFlags() and fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Mar 19, 2023
1 parent 387f291 commit 83c4c2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
- name: TCP tunnel
run: |
set -eux
./webrtc-piping tunnel -s http://localhost:8080 8888 mypath &
./webrtc-piping tunnel -s http://localhost:8080 -l 9999 mypath &
./webrtc-piping -s http://localhost:8080 tunnel 8888 mypath &
./webrtc-piping -s http://localhost:8080 tunnel -l 9999 mypath &
sleep 1
curl -sS localhost:8888
curl -sS localhost:8888
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func init() {
if !ok {
defaultServer = "https://ppng.io"
}
RootCmd.Flags().StringVarP(&flags.pipingServerUrl, "server", "s", defaultServer, "Piping Server URL")
RootCmd.PersistentFlags().StringVarP(&flags.pipingServerUrl, "server", "s", defaultServer, "Piping Server URL")
RootCmd.PersistentFlags().StringVar(&flags.dnsServer, "dns-server", "", "DNS server (e.g. 1.1.1.1:53)")
// --insecure, -k is inspired by curl
RootCmd.PersistentFlags().BoolVarP(&flags.insecure, "insecure", "k", false, "Allow insecure server connections when using SSL")
RootCmd.PersistentFlags().StringArrayVarP(&flags.httpHeaderKeyValueStrs, "header", "H", []string{}, "HTTP header")
RootCmd.Flags().BoolVarP(&flags.showsVersion, "version", "V", false, "show version")
RootCmd.Flags().BoolVarP(&flags.verbose, "verbose", "v", false, "verbose output")
RootCmd.PersistentFlags().BoolVarP(&flags.showsVersion, "version", "V", false, "show version")
RootCmd.PersistentFlags().BoolVarP(&flags.verbose, "verbose", "v", false, "verbose output")
}

var RootCmd = &cobra.Command{
Expand Down

0 comments on commit 83c4c2e

Please sign in to comment.