-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2dcec0
commit 452fddb
Showing
23 changed files
with
637 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
capybara | ||
output | ||
bin | ||
input |
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,67 @@ | ||
package border | ||
|
||
import ( | ||
"github.com/sincerefly/capybara/base/log" | ||
"github.com/sincerefly/capybara/cmd/border_common" | ||
"github.com/sincerefly/capybara/cmd/cmdutils" | ||
"github.com/sincerefly/capybara/service/border" | ||
"github.com/sincerefly/capybara/service/border/styles" | ||
"github.com/sincerefly/capybara/utils/colorizer" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var LogoMelonCmd = &cobra.Command{ | ||
Use: "melon", | ||
Short: "Style: logo left, no padding", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
parameter := &styles.LogoMelonParameter{} | ||
|
||
input := cmdutils.GetParam(cmd.Flags(), "input") | ||
parameter.SetInput(input) | ||
|
||
output := cmdutils.GetParam(cmd.Flags(), "output") | ||
parameter.SetOutput(output) | ||
|
||
// width param | ||
width := cmdutils.GetIntParam(cmd.Flags(), "width") | ||
if fixedWidth, fixed := border_common.FixedBorderWidth(width); fixed { | ||
log.Warn("border width fixed with %d", fixedWidth) | ||
width = fixedWidth | ||
} | ||
parameter.SetBorderWidth(width) | ||
|
||
// color param | ||
colorStr := cmdutils.GetParam(cmd.Flags(), "color") | ||
col, err := colorizer.ToColor(colorStr) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
parameter.SetBorderColor(col) | ||
|
||
// bottom container height | ||
containerHeight, set := cmdutils.GetIntParamB(cmd.Flags(), "container-height") | ||
parameter.SetBottomContainerHeight(containerHeight) | ||
parameter.SetIsContainerHeightSet(set) | ||
|
||
// bottom container height | ||
containerHeightRatio := cmdutils.GetFloat64Param(cmd.Flags(), "container-height-ratio") | ||
parameter.SetBottomContainerHeightRatio(containerHeightRatio) | ||
|
||
// run | ||
log.Debugf("parameter: %s", parameter.JSONString()) | ||
border.NewStyleProcessor(border.StyleLogoMelon, parameter).Run() | ||
}, | ||
} | ||
|
||
func init() { | ||
|
||
flags := LogoMelonCmd.Flags() | ||
flags.StringP("input", "i", "input", "specify input folder") | ||
flags.StringP("output", "o", "output", "specify output folder") | ||
flags.IntP("width", "w", 100, "specify border width") | ||
flags.StringP("color", "c", "white", "specify border color") | ||
flags.IntP("container-height", "", 300, "bottom logo container height") | ||
flags.Float64P("container-height-ratio", "", 0.12, "bottom logo container height, image based height") | ||
flags.BoolP("without-subtitle", "", false, "without subtitle") | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/sincerefly/capybara/base/log" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestGetNikonLogoTmpFsPath(t *testing.T) { | ||
path, err := CreateTemporaryLogoFile("NIKON") | ||
assert.Nil(t, err) | ||
log.Info(path) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.