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

fix(proxy): use and define arity to set transparent input (#172) #176

Merged
merged 1 commit into from
Feb 20, 2024
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"plog",
"prealloc",
"promptui",
"randemoji",
"repotoken",
"samber",
"sidewalk",
Expand Down
18 changes: 15 additions & 3 deletions src/app/proxy/enter-shrink.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (e *ShrinkEntry) run() (result *nav.TraverseResult, err error) {
e.PrincipalOptionsFn,
runnerWith,
resumption,
e.Inputs.Root.PreviewFam.Native.DryRun,
e.Inputs,
))

return result, err
Expand All @@ -169,13 +169,25 @@ func EnterShrink(
err error
)

schemes := params.Inputs.Root.Configs.Schemes
selectedScheme := params.Inputs.Root.ProfileFam.Native.Scheme
scheme, _ := schemes.Scheme(selectedScheme)
noProfiles := lo.TernaryF(scheme == nil,
func() uint {
return 1
},
func() uint {
return uint(len(scheme.Profiles()))
},
)
finder := filing.NewFinder(&filing.NewFinderInfo{
Advanced: params.Inputs.Root.Configs.Advanced,
Schemes: params.Inputs.Root.Configs.Schemes,
Scheme: params.Inputs.Root.ProfileFam.Native.Scheme,
Schemes: schemes,
Scheme: selectedScheme,
OutputPath: params.Inputs.ParamSet.Native.OutputPath,
TrashPath: params.Inputs.ParamSet.Native.TrashPath,
Observer: params.Inputs.Root.Observers.PathFinder,
Arity: noProfiles,
})
fileManager := filing.NewManager(params.Vfs, finder,
params.Inputs.Root.PreviewFam.Native.DryRun,
Expand Down
2 changes: 1 addition & 1 deletion src/app/proxy/filing/file-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (fm *FileManager) Finder() common.PathFinder {

func (fm *FileManager) Create(path string, overwrite bool) error {
if fm.Vfs.FileExists(path) && !overwrite {
return os.ErrExist
return errors.Wrapf(os.ErrExist, "could not create file at path: '%v'", path)
}

file, err := fm.Vfs.Create(path)
Expand Down
3 changes: 2 additions & 1 deletion src/app/proxy/filing/path-finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type NewFinderInfo struct {
OutputPath string
TrashPath string
Observer common.PathFinder
Arity uint
}

func NewFinder(
Expand Down Expand Up @@ -179,7 +180,7 @@ func (f *PathFinder) init(info *NewFinderInfo) {
// When the user specifies an alternative location for the results to be sent to
// with the --output flag, then the input is no longer transparent, as the user has
// to go to the output location to see the result.
f.transparentInput = info.OutputPath == ""
f.transparentInput = info.OutputPath == "" && info.Arity == 1

journal := info.Advanced.JournalLabel()

Expand Down
Loading
Loading