forked from sander-skjulsvik/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: comparedirs multithread (sander-skjulsvik#19)
Added compare dir with support for multithread. And refactored to mostly implement a strategy pattern * fixed test status badge * Selecting run method with passing runfunc around. This is a start of a strategy pattern * Implemented strategi pattern for dupes (I think) * Implemented strategi pattern for compareDirs * Moved func selection to cli.go * runComparison now actually uses compFunc method, and we are adding paths to comparator struct * Selecting the correct compare dirs functions for testing * Added some error handling for cli unput * moved is file to files, and added func AddBarDirSize --------- Co-authored-by: sander skjulsvik <[email protected]>
- Loading branch information
1 parent
d4fb148
commit c86fd4d
Showing
16 changed files
with
331 additions
and
170 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
File renamed without changes.
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,24 @@ | ||
package common | ||
|
||
import "github.com/sander-skjulsvik/tools/libs/progressbar" | ||
|
||
// Run is the main function to run for consumers of this lib. | ||
// First arg is the path to the folder, | ||
type Run func(string, progressbar.ProgressBar) *Dupes | ||
|
||
type Runner struct { | ||
RunFunc Run | ||
ProgressBar progressbar.ProgressBar | ||
OutputJson bool | ||
} | ||
|
||
func NewRunner(runFunc Run, bar progressbar.ProgressBar) *Runner { | ||
return &Runner{ | ||
RunFunc: runFunc, | ||
ProgressBar: bar, | ||
} | ||
} | ||
|
||
func (r *Runner) Run(path string) *Dupes { | ||
return r.RunFunc(path, r.ProgressBar) | ||
} |
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
Oops, something went wrong.