Skip to content

Commit

Permalink
Merge pull request #3 from galihrivanto/investigate-race
Browse files Browse the repository at this point in the history
Use better synchronization between command
  • Loading branch information
galihrivanto authored Feb 15, 2021
2 parents 558bd0a + 9ef38ed commit a96462f
Show file tree
Hide file tree
Showing 8 changed files with 995 additions and 99 deletions.
19 changes: 12 additions & 7 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func FileOpen(filePath string) string {

// FileClose .
func FileClose() string {
return "file-close:"
return "file-close"
}

// SelectAll .
Expand Down Expand Up @@ -144,15 +144,15 @@ func SelectClear() string {
}

// InvertOption define option when invert selection
type InvertOption string
type InvertOption string

// invert selection option
const (
InvertOptionAll InvertOption = "all"
InvertOptionLayers = "layers"
InvertOptionNoLayers = "no-layers"
InvertOptionGroup = "group"
InvertOptionNoGroup = "no-group"
InvertOptionAll InvertOption = "all"
InvertOptionLayers = "layers"
InvertOptionNoLayers = "no-layers"
InvertOptionGroup = "group"
InvertOptionNoGroup = "no-group"
)

// SelectInvert .
Expand All @@ -164,3 +164,8 @@ func SelectInvert(option InvertOption) string {
func SelectList() string {
return "select-list"
}

// Version print inksscape version and return
func Version() string {
return "inkscape-version"
}
3 changes: 3 additions & 0 deletions circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion cmd/svg2pdf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
var (
svgInput string
pdfOutput string
verbose bool
)

func handleErr(err error) {
Expand All @@ -23,14 +24,16 @@ func handleErr(err error) {
func main() {
flag.StringVar(&svgInput, "input", "", "svg input")
flag.StringVar(&pdfOutput, "output", "result.pdf", "pdf output")
flag.BoolVar(&verbose, "verbose", false, "verbose output")
flag.Parse()

if svgInput == "" {
fmt.Println("svg input is missing")
os.Exit(1)
}

proxy := inkscape.NewProxy(inkscape.Verbose(true))
proxy := inkscape.NewProxy(inkscape.Verbose(verbose))

err := proxy.Run()
handleErr(err)
defer proxy.Close()
Expand Down
790 changes: 790 additions & 0 deletions cmd/svg2pdf/maincon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cmd/svg2pdf/xxx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ type Options struct {
// maximum retry attempt
maxRetry int

// maximum command queue size
commandQueueLength int

// set verbosity
verbose bool
}
Expand All @@ -33,6 +36,13 @@ func MaxRetry(retry int) Option {
}
}

// CommandQueueLength override maximum command queue size
func CommandQueueLength(length int) Option {
return func(o *Options) {
o.commandQueueLength = length
}
}

// Verbose override log verbosity
// useful for debugging
func Verbose(verbose bool) Option {
Expand Down
Loading

0 comments on commit a96462f

Please sign in to comment.