github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/commands/generic/generic.go (about)

     1  package generic
     2  
     3  import (
     4  	commandsutils "github.com/jfrog/jfrog-cli-go/artifactory/commands/utils"
     5  	"github.com/jfrog/jfrog-cli-go/artifactory/spec"
     6  	"github.com/jfrog/jfrog-cli-go/utils/config"
     7  )
     8  
     9  type GenericCommand struct {
    10  	rtDetails       *config.ArtifactoryDetails
    11  	spec            *spec.SpecFiles
    12  	result          *commandsutils.Result
    13  	dryRun          bool
    14  	syncDeletesPath string
    15  	quiet           bool
    16  }
    17  
    18  func NewGenericCommand() *GenericCommand {
    19  	return &GenericCommand{result: new(commandsutils.Result)}
    20  }
    21  
    22  func (gc *GenericCommand) DryRun() bool {
    23  	return gc.dryRun
    24  }
    25  
    26  func (gc *GenericCommand) SetDryRun(dryRun bool) *GenericCommand {
    27  	gc.dryRun = dryRun
    28  	return gc
    29  }
    30  
    31  func (gc *GenericCommand) SyncDeletesPath() string {
    32  	return gc.syncDeletesPath
    33  }
    34  
    35  func (gc *GenericCommand) SetSyncDeletesPath(syncDeletes string) *GenericCommand {
    36  	gc.syncDeletesPath = syncDeletes
    37  	return gc
    38  }
    39  
    40  func (gc *GenericCommand) Quiet() bool {
    41  	return gc.quiet
    42  }
    43  
    44  func (gc *GenericCommand) SetQuiet(quiet bool) *GenericCommand {
    45  	gc.quiet = quiet
    46  	return gc
    47  }
    48  
    49  func (gc *GenericCommand) Result() *commandsutils.Result {
    50  	return gc.result
    51  }
    52  
    53  func (gc *GenericCommand) Spec() *spec.SpecFiles {
    54  	return gc.spec
    55  }
    56  
    57  func (gc *GenericCommand) SetSpec(spec *spec.SpecFiles) *GenericCommand {
    58  	gc.spec = spec
    59  	return gc
    60  }
    61  
    62  func (gc *GenericCommand) RtDetails() (*config.ArtifactoryDetails, error) {
    63  	return gc.rtDetails, nil
    64  }
    65  
    66  func (gc *GenericCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *GenericCommand {
    67  	gc.rtDetails = rtDetails
    68  	return gc
    69  }