Skip to content

Commit 22a3988

Browse files
committed
cmd/lncli: move commands and export
We want to export some of our CLI code to re-use in other projects. But in Golang you cannot import code from a `main` package. So we need to move the actual code into its own package and only have the `func main()` in the `main` package.
1 parent 75477c8 commit 22a3988

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+841
-674
lines changed

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ issues:
259259
- forbidigo
260260
- godot
261261

262-
# Allow fmt.Printf() in lncli.
263-
- path: cmd/lncli/*
262+
# Allow fmt.Printf() in commands.
263+
- path: cmd/commands/*
264264
linters:
265265
- forbidigo
266266

cmd/lncli/arg_parse.go renamed to cmd/commands/arg_parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"regexp"

cmd/lncli/arg_parse_test.go renamed to cmd/commands/arg_parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"testing"

cmd/lncli/autopilotrpc_active.go renamed to cmd/commands/autopilotrpc_active.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//go:build autopilotrpc
22
// +build autopilotrpc
33

4-
package main
4+
package commands
55

66
import (
77
"github.com/lightningnetwork/lnd/lnrpc/autopilotrpc"

cmd/lncli/autopilotrpc_default.go renamed to cmd/commands/autopilotrpc_default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//go:build !autopilotrpc
22
// +build !autopilotrpc
33

4-
package main
4+
package commands
55

66
import "github.com/urfave/cli"
77

cmd/lncli/chainrpc_active.go renamed to cmd/commands/chainrpc_active.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//go:build chainrpc
22
// +build chainrpc
33

4-
package main
4+
package commands
55

66
import (
77
"bytes"

cmd/lncli/chainrpc_default.go renamed to cmd/commands/chainrpc_default.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//go:build !chainrpc
22
// +build !chainrpc
33

4-
package main
4+
package commands
55

66
import "github.com/urfave/cli"
77

cmd/lncli/cmd_custom.go renamed to cmd/commands/cmd_custom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"encoding/hex"

cmd/lncli/cmd_debug.go renamed to cmd/commands/cmd_debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"bytes"

cmd/lncli/cmd_import_mission_control.go renamed to cmd/commands/cmd_import_mission_control.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package commands
22

33
import (
44
"context"

0 commit comments

Comments
 (0)