Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match binary name by prefix, not exact match #520

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func handleCLI(args []string) error {
// Being case-insensitive
execName = strings.ToLower(execName)

if execName == "stash_plugin" || execName == "osdf_plugin" || execName == "pelican_xfer_plugin" {
if strings.HasPrefix(execName, "stash_plugin") || strings.HasPrefix(execName, "osdf_plugin") || strings.HasPrefix(execName, "pelican_xfer_plugin") {
stashPluginMain(args[1:])
} else if execName == "stashcp" {
} else if strings.HasPrefix(execName, "stashcp") {
err := copyCmd.Execute()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions cmd/object_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func init() {
flagSet.StringP("cache-list-name", "n", "xroot", "(Deprecated) Cache list to use, currently either xroot or xroots; may be ignored")
flagSet.Lookup("cache-list-name").Hidden = true
// All the deprecated or hidden flags that are only relevant if we are in historical "stashcp mode"
if execName == "stashcp" {
if strings.HasPrefix(execName, "stashcp") {
copyCmd.Use = "stashcp {source ...} {destination}"
copyCmd.Short = "Copy a file to/from the OSDF"
flagSet.Lookup("cache-list-name").Hidden = false // Expose the help for this option
Expand All @@ -82,7 +82,7 @@ func copyMain(cmd *cobra.Command, args []string) {
client.ObjectClientOptions.Version = version

// Need to check just stashcp since it does not go through root, the other modes get checked there
if execName == "stashcp" {
if strings.HasPrefix(execName, "stashcp") {
if val, err := cmd.Flags().GetBool("debug"); err == nil && val {
config.SetLogging(log.DebugLevel)
} else {
Expand Down
Loading