-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ryan Svihla
committed
Mar 3, 2021
1 parent
7e37805
commit 69e5e7e
Showing
14 changed files
with
72 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
github.com/rsds143/astra-devops-sdk-go v0.1.4-0.20210222125150-d3960adebd40 h1:fgClCsf9TmGJGy03lxCCPPlc7dXqBzPI1ASAME4I6gM= | ||
github.com/rsds143/astra-devops-sdk-go v0.1.4-0.20210222125150-d3960adebd40/go.mod h1:LQaUwm75Ydy/z71nl466Xv0yw8ib5b9L6laTFXbvtHU= | ||
github.com/rsds143/astra-devops-sdk-go v0.1.4 h1:pcle2nixye+eIbq/FB0+Jy0cEJgz1CKjevPXyJI/M+A= | ||
github.com/rsds143/astra-devops-sdk-go v0.1.4/go.mod h1:LQaUwm75Ydy/z71nl466Xv0yw8ib5b9L6laTFXbvtHU= | ||
github.com/rsds143/astra-devops-sdk-go v0.1.5 h1:BwE7ApI5r9eMySK9fmOmWpE9vSWh6+nRKeBOCBsoHbE= | ||
github.com/rsds143/astra-devops-sdk-go v0.1.5/go.mod h1:LQaUwm75Ydy/z71nl466Xv0yw8ib5b9L6laTFXbvtHU= | ||
github.com/rsds143/astra-devops-sdk-go v0.2.0 h1:Oq5fWejjQ7pr3D7IeFrEO7hybvGHa++MdTMtvA+VEIU= | ||
github.com/rsds143/astra-devops-sdk-go v0.2.0/go.mod h1:LQaUwm75Ydy/z71nl466Xv0yw8ib5b9L6laTFXbvtHU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
Copyright 2021 Ryan Svihla | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package pkg | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
//PrintFlags outputs all of the flag parameters for a flagset | ||
func PrintFlags(flagSet *flag.FlagSet, name string, desc string) string { | ||
var out strings.Builder | ||
out.WriteString(fmt.Sprintf("\t%v #%v\n", name, desc)) | ||
var flags [][]string | ||
flagSet.VisitAll(func(f *flag.Flag) { | ||
if f.Value.String() != "" { | ||
flags = append(flags, []string{ | ||
fmt.Sprintf("-%v", f.Name), | ||
f.Usage, | ||
fmt.Sprintf("default: %v", f.Value), | ||
}) | ||
} else { | ||
flags = append(flags, []string{ | ||
fmt.Sprintf("-%v", f.Name), | ||
f.Usage, | ||
"", | ||
}) | ||
} | ||
}) | ||
for _, row := range PadColumns(flags) { | ||
out.WriteString(fmt.Sprintf("\t\t %v\n", strings.Join(row, " "))) | ||
} | ||
return out.String() | ||
} |