Skip to content

Commit 9b0d6a5

Browse files
committed
shortened default output file name
readme updated
1 parent b7ebe36 commit 9b0d6a5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Like `binary.Read`, but a bit different and without reflection.
1313
array of arrays and slice of arrays are not supported right now)
1414
- no reflection in generated code, it is simple and fast
1515
- possibility to select type[s] to serialize via `-types` CLI flag
16-
- possibility to select output function names (and exportability, as implied by Go)
16+
- customize output function names
17+
- customize output file name
1718

1819
### Advanced
1920
- slice field length can be set to any expression that returns `int`, by using tags. Currently [de]serialized instance can be referred to as "`o`", within expression.
@@ -30,10 +31,11 @@ Remember that only fields that get read _before_ the slice field will have meani
3031

3132
- `-types` (required): can be a comma-separated list of types you want to process, or reserved keyword `all` for processing all top-level `struct`s, found in file.
3233
`all` usage and requiredness of the argument can change in the future.
34+
- `-output` (optional): set output file name.
3335

3436
#### Custom
3537

36-
`//go:generate go run github.com/am4n0w4r/simser -types=Header -read-fn-name=customReadFnName -write-fn-name=CustomWriteFnName`
38+
`//go:generate go run github.com/am4n0w4r/simser -types=Header -output=file.name -read-fn-name=customReadFnName -write-fn-name=CustomWriteFnName`
3739

3840
- `-read-fn-name` (optional): custom name for deserializing function. Is set per-file.
3941
- `-write-fn-name` (optional): custom name for deserializing function. Is set per-file.

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func getConfig() (c config, err error) {
5959
flag.Parse()
6060

6161
if c.outputFile == "" {
62-
c.outputFile = fmt.Sprintf("%s.simser.g.go", strings.TrimSuffix(c.targetFile, ".go"))
62+
c.outputFile = fmt.Sprintf("%s.simser.go", strings.TrimSuffix(c.targetFile, ".go"))
6363
}
6464

6565
return c, nil

0 commit comments

Comments
 (0)