mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
lncli+makefile: generate man pages automatically for lncli and lnd
This commit is contained in:
parent
dfd1636f18
commit
158b802f49
14
Makefile
14
Makefile
@ -3,6 +3,8 @@ ESCPKG := github.com\/lightningnetwork\/lnd
|
||||
MOBILE_PKG := $(PKG)/mobile
|
||||
TOOLS_DIR := tools
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
|
||||
BTCD_PKG := github.com/btcsuite/btcd
|
||||
GOACC_PKG := github.com/ory/go-acc
|
||||
GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports
|
||||
@ -122,12 +124,20 @@ build-itest-race:
|
||||
@$(call print, "Building itest binary for ${backend} backend.")
|
||||
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(RPC_TAGS) integration $(backend)" -c -o itest/itest.test$(EXEC_SUFFIX)
|
||||
|
||||
#? install: Build and install lnd and lncli binaries, place them in $GOPATH/bin
|
||||
install:
|
||||
#? install-binaries: Build and install lnd and lncli binaries, place them in $GOPATH/bin
|
||||
install-binaries:
|
||||
@$(call print, "Installing lnd and lncli.")
|
||||
$(GOINSTALL) -tags="${tags}" -ldflags="$(RELEASE_LDFLAGS)" $(PKG)/cmd/lnd
|
||||
$(GOINSTALL) -tags="${tags}" -ldflags="$(RELEASE_LDFLAGS)" $(PKG)/cmd/lncli
|
||||
|
||||
#? manpages: generate and install man pages
|
||||
manpages:
|
||||
@$(call print, "Generating man pages lncli.1 and lnd.1.")
|
||||
./scripts/gen_man_pages.sh $(DESTDIR) $(PREFIX)
|
||||
|
||||
#? install: Build and install lnd and lncli binaries, place them in $GOPATH/bin, generate and install man pages
|
||||
install: install-binaries manpages
|
||||
|
||||
#? release-install: Build and install lnd and lncli release binaries, place them in $GOPATH/bin
|
||||
release-install:
|
||||
@$(call print, "Installing release lnd and lncli.")
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
@ -1410,6 +1412,41 @@ func channelBalance(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var generateManPageCommand = cli.Command{
|
||||
Name: "generatemanpage",
|
||||
Usage: "Generates a man page for lncli and lnd as " +
|
||||
"lncli.1 and lnd.1 respectively.",
|
||||
Hidden: true,
|
||||
Action: actionDecorator(generateManPage),
|
||||
}
|
||||
|
||||
func generateManPage(ctx *cli.Context) error {
|
||||
// Generate the man pages for lncli as lncli.1.
|
||||
manpages, err := ctx.App.ToMan()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.WriteFile("lncli.1", []byte(manpages), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate the man pages for lnd as lnd.1.
|
||||
config := lnd.DefaultConfig()
|
||||
fileParser := flags.NewParser(&config, flags.Default)
|
||||
fileParser.Name = "lnd"
|
||||
|
||||
var buf bytes.Buffer
|
||||
fileParser.WriteManPage(&buf)
|
||||
|
||||
err = os.WriteFile("lnd.1", buf.Bytes(), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var getInfoCommand = cli.Command{
|
||||
Name: "getinfo",
|
||||
Usage: "Returns basic information related to the active daemon.",
|
||||
|
@ -508,6 +508,7 @@ func main() {
|
||||
fishCompletionCommand,
|
||||
listAliasesCommand,
|
||||
estimateRouteFeeCommand,
|
||||
generateManPageCommand,
|
||||
}
|
||||
|
||||
// Add any extra commands determined by build flags.
|
||||
|
Loading…
x
Reference in New Issue
Block a user