Skip to content

Commit

Permalink
add timeout flag and add VERSION to logo
Browse files Browse the repository at this point in the history
  • Loading branch information
unreal committed Jun 12, 2019
1 parent 55594f6 commit 1ebc0de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion commenter/commenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strconv"
"strings"
"time"

"github.com/360EntSecGroup-Skylar/excelize"
"github.com/onerobotics/comtool"
Expand All @@ -29,6 +30,7 @@ type Config struct {
Aouts string
Sregs string
Flags string
Timeout int // milliseconds
}

type commenter struct {
Expand Down Expand Up @@ -207,7 +209,7 @@ func (c *commenter) processColumn(startCell string, fCode comtool.FunctionCode,
c.warn("Comment in cell %s truncated from '%s' to '%s'. (%d > %d)\n", cellName, oldComment, comment, len(oldComment), maxLength)
}

err = comtool.Set(fCode, id, comment, host)
err = comtool.Set(fCode, id, comment, host, time.Duration(time.Duration(c.Config.Timeout)*time.Millisecond))
if err != nil {
return count, err
}
Expand Down
6 changes: 5 additions & 1 deletion fexcel.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/onerobotics/fexcel/commenter"
)

const VERSION = "1.0-beta.4"

var (
sheetName string
offset int
Expand All @@ -20,6 +22,7 @@ const logo = ` __ _
| _/ _ \ \/ / __/ _ \ |
| || __/> < (_| __/ |
|_| \___/_/\_\___\___|_|
v1.0-beta.4
by ONE Robotics Company
www.onerobotics.com
Expand All @@ -30,7 +33,7 @@ func usage() {
fmt.Fprintf(os.Stderr, logo)
fmt.Fprintf(os.Stderr, "Usage: fexcel [options] filename host(s)...\n\n")

fmt.Fprintf(os.Stderr, "Example: fexcel -sheet Data -numregs A2 -posregs D2 spreadsheet.xlsx 127.0.0.101 127.0.0.102\n\n")
fmt.Fprintf(os.Stderr, "Example: fexcel -sheet Data -numregs A2 -posregs D2 -timeout 1000 spreadsheet.xlsx 127.0.0.101 127.0.0.102\n\n")
fmt.Fprintf(os.Stderr, "Options:\n")
flag.PrintDefaults()
os.Exit(1)
Expand All @@ -52,6 +55,7 @@ func init() {
flag.StringVar(&cfg.Aouts, "aouts", "", "start cell of analog output ids")
flag.StringVar(&cfg.Sregs, "sregs", "", "start cell of string register ids")
flag.StringVar(&cfg.Flags, "flags", "", "start cell of flag ids")
flag.IntVar(&cfg.Timeout, "timeout", 500, "timeout value in milliseconds")
}

func check(err error) {
Expand Down

0 comments on commit 1ebc0de

Please sign in to comment.