Documentation ¶
Index ¶
- Variables
- func IsUsingXDG(vc configuration.ViperConfig) bool
- type AdvancedConfig
- type AfterFunc
- type CallbackOnBegin
- type CallbackOnBeginFunc
- type ClientTraverseInfo
- type ConfigInfo
- type ConfigRunner
- type ConfigScope
- type Configs
- type DiscoveredMsg
- type DriverTraverseInfo
- type ExecutableConfig
- type ExecutionAgent
- type Executor
- type ExtensionsConfig
- type FileManager
- type FinishedMsg
- type InteractionConfig
- type InterlaceEnum
- type ItemController
- type JournalMetaInfo
- type LifecycleNotifications
- type LoggingConfig
- type Observers
- type PathFinder
- type PathInfo
- type PresentationOptions
- type PrivateControllerInfo
- type ProfilesConfig
- type ProfilesConfigMap
- type ProfilesFlagOptionAsAnyPair
- type ProgressMsg
- type RootCommandInputs
- type RootParameterSet
- type RunStepInfo
- type SamplerConfig
- type SamplingFactorEnum
- type SchemeConfig
- type SchemesConfig
- type Sequence
- type SessionControllerInfo
- type ShrinkCommandInputs
- type ShrinkParameterSet
- type StaticInfo
- func (i *StaticInfo) FileSupplement(baseFilename, supp string) string
- func (i *StaticInfo) JournalFilterGlob() string
- func (i *StaticInfo) JournalFilterRegex(sourcePattern, suffixesCSV string) string
- func (i *StaticInfo) JournalLocation(name, parent string) string
- func (i *StaticInfo) TrashTag() string
- type Step
- type ThirdPartySet
- type TraverseInfoTrash
- type TuiConfig
- type UserInteraction
- type WalkInfo
Constants ¶
This section is empty.
Variables ¶
var Definitions = definitions{ Pixa: pixaDefs{ AppName: appName, Emoji: "🧙", SourceID: "github.com/snivilised/pixa", ConfigTestFilename: fmt.Sprintf("%v-test", appName), ConfigType: yml, SubPath: filepath.Join(org, appName), Org: org, }, ThirdParty: thirdPartyDefs{ Magick: "magick", Dummy: "dummy", Fake: "fake", }, Commands: commandDefs{ Shrink: "shrink", }, Defaults: defaultDefs{ Config: configDefs{ ConfigFilename: fmt.Sprintf("%v.%v", appName, yml), }, Logging: loggingDefs{ LogFilename: fmt.Sprintf("%v.log", appName), }, }, Environment: environmentDefs{ Home: "PIXA_HOME", UseXDG: "PIXA_XDG", }, Filing: filingDefs{ JournalExt: ".txt", Discriminator: ".$", }, Interaction: interactionDefs{ Names: struct { Discovery string Primary string }{ Discovery: "discover", Primary: "primary", }, }, }
var InterlaceEnumInfo = assistant.NewEnumInfo(assistant.AcceptableEnumValues[InterlaceEnum]{ InterlaceNoneEn: []string{"none", "n"}, InterlaceLineEn: []string{"line", "l"}, InterlacePlaneEn: []string{"plane", "pl"}, InterlacePartitionEn: []string{"partition", "pa"}, InterlaceJPEGEn: []string{"jpeg", "j"}, InterlaceGIFEn: []string{"gif", "g"}, InterlacePNGEn: []string{"png", "p"}, })
var Permissions = permissions{
Write: write,
Faydeaudeau: faydeaudeau,
Beezledub: beezledub,
}
var SamplingFactorEnumInfo = assistant.NewEnumInfo(assistant.AcceptableEnumValues[SamplingFactorEnum]{ SamplingFactor420En: []string{"4:2:0", "420", "4"}, SamplingFactor2x1En: []string{"2x1", "21", "2"}, })
Functions ¶
func IsUsingXDG ¶
func IsUsingXDG(vc configuration.ViperConfig) bool
Types ¶
type AdvancedConfig ¶
type AdvancedConfig interface { AbortOnError() bool AdhocLabel() string JournalLabel() string LegacyLabel() string TrashLabel() string FakeLabel() string SupplementLabel() string SampleLabel() string Extensions() ExtensionsConfig Executable() ExecutableConfig }
type AfterFunc ¶
type AfterFunc func(*nav.TraverseResult, error)
type CallbackOnBegin ¶
type CallbackOnBegin interface {
Notify(finder PathFinder, scheme, profile string)
}
type CallbackOnBeginFunc ¶
type CallbackOnBeginFunc func(finder PathFinder, scheme, profile string)
func (CallbackOnBeginFunc) Notify ¶
func (f CallbackOnBeginFunc) Notify(finder PathFinder, scheme, profile string)
type ClientTraverseInfo ¶
type ClientTraverseInfo interface { Name() string // ActiveOptionsFn allows the client to obtain the options func // for the current phase. ActiveOptionsFn() nav.TraverseOptionFn RunWith() nav.CreateNewRunnerWith Resumption() *nav.Resumption IsDryRun() bool }
ClientTraverseInfo represents an entity which needs start a navigation operation.
type ConfigInfo ¶
type ConfigInfo struct { Name string ConfigType string ConfigPath string Viper configuration.ViperConfig Scope ConfigScope }
type ConfigRunner ¶
type ConfigScope ¶
type Configs ¶
type Configs struct { Profiles ProfilesConfig Schemes SchemesConfig Sampler SamplerConfig Interaction InteractionConfig Advanced AdvancedConfig Logging LoggingConfig }
type DiscoveredMsg ¶
type DiscoveredMsg struct { Result *nav.TraverseResult Err error }
DiscoveredMsg indicates that the discovery phase has completed.
type DriverTraverseInfo ¶
type DriverTraverseInfo interface { ClientTraverseInfo // Next allows the driver to indicate switching over to the next // phase of traversal. The underlying info object starts off in // discovery state, the driver switches it into the principal // phase by calling Next. Next() }
DriverTraverseInfo represents the controller entity that controls the whole traversal consisting of discovery and principal phases.
type ExecutableConfig ¶
type ExecutionAgent ¶
type ExecutionAgent interface { // IsInstalled determines whether the underlying program is installed IsInstalled() bool // Invoke returns the command line args required for the executor to // run correctly. Only the source and destination are required because // they are the dynamic args that change for each invocation. All the // other flags that come directly from the command line/config possibly // via a profile are static, which means the concrete agent will already // have those and merely has to formulate the complete command line in // the correct order required by the third party program. Invoke(thirdPartyCL clif.ThirdPartyCommandLine, source, destination string) error }
type ExtensionsConfig ¶
type FileManager ¶
type FinishedMsg ¶
type FinishedMsg struct { Result *nav.TraverseResult Err error }
FinishedMsg indicates end of traversal
type InteractionConfig ¶
type InteractionConfig interface {
TuiConfig() TuiConfig
}
type InterlaceEnum ¶
type InterlaceEnum int
const ( InterlaceNoneEn InterlaceEnum InterlaceLineEn InterlacePlaneEn InterlacePartitionEn InterlaceJPEGEn InterlaceGIFEn InterlacePNGEn )
type ItemController ¶
type ItemController interface { OnNewShrinkItem(item *nav.TraverseItem) error Reset() }
ItemController
type JournalMetaInfo ¶
type LifecycleNotifications ¶
type LifecycleNotifications struct {
OnBegin CallbackOnBeginFunc
}
type LoggingConfig ¶
type Observers ¶
type Observers struct {
PathFinder PathFinder
}
type PathFinder ¶
type PathFinder interface { Transfer(info *PathInfo) (folder, file string) Result(info *PathInfo) (folder, file string) FolderSupplement(profile string) string FileSupplement(profile, withSampling string) string SampleFileSupplement(withSampling string) string TransparentInput() bool JournalFullPath(item *nav.TraverseItem) string Statics() *StaticInfo Scheme() string Observe(o PathFinder) PathFinder }
type PathInfo ¶
type PathInfo struct { Item *nav.TraverseItem Origin string Scheme string Profile string RunStep RunStepInfo IsCuddling bool IsSampling bool Output string Trash string }
type PresentationOptions ¶
type PresentationOptions struct {
WithoutRenderer bool
}
type PrivateControllerInfo ¶
type ProfilesConfig ¶
type ProfilesConfig interface {
Profile(name string) (clif.ChangedFlagsMap, bool)
}
type ProfilesConfigMap ¶
type ProfilesConfigMap map[string]clif.ChangedFlagsMap
func (ProfilesConfigMap) Validate ¶
func (pc ProfilesConfigMap) Validate(name string) error
type ProgressMsg ¶
ProgressMsg indicates a job completion
type RootCommandInputs ¶
type RootCommandInputs struct { ParamSet *assistant.ParamSet[RootParameterSet] PreviewFam *assistant.ParamSet[store.PreviewParameterSet] WorkerPoolFam *assistant.ParamSet[store.WorkerPoolParameterSet] FoldersFam *assistant.ParamSet[store.FoldersFilterParameterSet] // !!! ProfileFam *assistant.ParamSet[store.ProfileParameterSet] CascadeFam *assistant.ParamSet[store.CascadeParameterSet] SamplingFam *assistant.ParamSet[store.SamplingParameterSet] TextualFam *assistant.ParamSet[store.TextualInteractionParameterSet] Configs *Configs Presentation *PresentationOptions Observers *Observers }
type RootParameterSet ¶
type RunStepInfo ¶
type RunStepInfo struct {
Source string
}
type SamplerConfig ¶
type SamplingFactorEnum ¶
type SamplingFactorEnum int
const ( SamplingFactor420En SamplingFactorEnum SamplingFactor2x1En )
type SchemeConfig ¶
type SchemeConfig interface {
Profiles() []string
}
type SchemesConfig ¶
type SchemesConfig interface { Validate(name string, profiles ProfilesConfig) error Scheme(name string) (SchemeConfig, bool) }
type SessionControllerInfo ¶
type SessionControllerInfo struct { Agent ExecutionAgent Inputs *ShrinkCommandInputs FileManager FileManager Interaction UserInteraction }
type ShrinkCommandInputs ¶
type ShrinkCommandInputs struct { Root *RootCommandInputs ParamSet *assistant.ParamSet[ShrinkParameterSet] PolyFam *assistant.ParamSet[store.PolyFilterParameterSet] }
type ShrinkParameterSet ¶
type ShrinkParameterSet struct { ThirdPartySet // OutputPath string TrashPath string Cuddle bool }
type StaticInfo ¶
type StaticInfo struct { Adhoc string Journal JournalMetaInfo Legacy string Trash string Fake string Supplement string Sample string }
func NewStaticInfoFromConfig ¶
func NewStaticInfoFromConfig(advanced AdvancedConfig) *StaticInfo
func (*StaticInfo) FileSupplement ¶
func (i *StaticInfo) FileSupplement(baseFilename, supp string) string
func (*StaticInfo) JournalFilterGlob ¶
func (i *StaticInfo) JournalFilterGlob() string
func (*StaticInfo) JournalFilterRegex ¶
func (i *StaticInfo) JournalFilterRegex(sourcePattern, suffixesCSV string) string
func (*StaticInfo) JournalLocation ¶
func (i *StaticInfo) JournalLocation(name, parent string) string
func (*StaticInfo) TrashTag ¶
func (i *StaticInfo) TrashTag() string
type ThirdPartySet ¶
type ThirdPartySet struct { GaussianBlur float32 SamplingFactorEn assistant.EnumValue[SamplingFactorEnum] InterlaceEn assistant.EnumValue[InterlaceEnum] Strip bool Quality int // Auxiliary // LongChangedCL cobrass.ThirdPartyCommandLine KnownBy cobrass.KnownByCollection }
ThirdPartySet represents flags that are only of use to the third party application being invoked (ie magick). These flags are of no significance to pixa, but we have to define them explicitly, because of a deficiency in cobra in the way it handles third party args. The convention in command line interfaces is that the double dash delineates arguments for third parties, and cobra does support this, but what it does not support is to extract and provide some way to access those args. Pixa needs this functionality so it can pass them onto magick. As it stands, we can't access those args (after the --), so we have to define them explicitly, then pass them on. This is less than desirable, because magick has a vast flag set, which in theory would mean re-implementing them all on pixa. We only define the ones relevant to compressing images.
type TraverseInfoTrash ¶
type TraverseInfoTrash struct { DiscoverOptionsFn nav.TraverseOptionFn PrincipalOptionsFn nav.TraverseOptionFn With nav.CreateNewRunnerWith Resumption *nav.Resumption IsDryRun bool }
type UserInteraction ¶
type UserInteraction interface { // Decorate allows the interaction to provide a wrapper around the callback. // If the interaction does not need it, then it just returns the target. Only // the Principal callback is decorated. // Decorate(target *nav.LabelledTraverseCallback) *nav.LabelledTraverseCallback // Performs the full traversal which consists of a discovery navigation followed // by the principal navigation. Traverse(di DriverTraverseInfo) (*nav.TraverseResult, error) // Tick allows the model to be updated, as activity occurs during // the traversal. // Tick(progress *ProgressMsg) }
type WalkInfo ¶
type WalkInfo struct { DiscoverOptionsFn nav.TraverseOptionFn PrincipalOptionsFn nav.TraverseOptionFn With nav.CreateNewRunnerWith Resumption *nav.Resumption }