-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
Following #59 (Search "Sidebar -- docopts.sh entrypoint wrapper" heading)
We discussed how to embed docopts.sh wrapper into docopts binary itself. One of the purpose is to keep a single standalone binary. May be it could also open some new feature and or behavior. So lets explore.
Pros
- both
docoptsand shell helper at the same place - coherent with example
- could be also outputted as
evaledcontent - could be stored in the
$PATHtoo at user preference ex:docopts get-wrapper docopts.sh > $HOME/bin/docopts.sh
Cons
- huge impact on
evalif the code is also evaled at run time
Go sample code
package main
import (
_ "embed"
"fmt"
)
//go:embed docopts.sh
var docopts_sh string
func main() {
fmt.Println(docopts_sh)
}Go code ref
https://pkg.go.dev/embed
https://go.dev/src/fmt/print.go
golang/go#28822 - discussion about automatic handling NEWLINE
https://en.wikipedia.org/wiki/Newline#Representation (seems macos moved to \n)
from issue above: notepad seems windows 10 to support \n
May 8th, 2018 - https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/
agilgur5agilgur5agilgur5