Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaned up some redundancies in the lit-af ls command #441

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions cmd/lit-af/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var lsCommand = &Command{
"What information to show. Provide one of:"),
fmt.Sprintf("\t%-20s %s",
lnutil.White("-a"),
"Information on connections to other peers"),
"Everything"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch :)

fmt.Sprintf("\t%-20s %s",
lnutil.White("conns"),
"Information on connections to other peers"),
Expand Down Expand Up @@ -343,34 +343,20 @@ func (lc *litAfClient) Ls(textArgs []string) error {
}
}

err = lc.Call("LitRPC.Balance", nil, bReply)
if err != nil {
return err
}

walHeights := map[uint32]int32{}
for _, b := range bReply.Balances {
walHeights[b.CoinType] = b.SyncHeight
}

err = lc.Call("LitRPC.ChannelList", nil, cReply)
if err != nil {
return err
}
if len(cReply.Channels) > 0 {
fmt.Fprintf(color.Output, "\t%s\n", lnutil.Header("Channels:"))
}

if cmd == "chans" || displayAllCommands {
err := lc.Call("LitRPC.ChannelList", nil, cReply)
if err != nil {
return err
}

if len(cReply.Channels) > 0 {
if displayAllCommands {
fmt.Fprintf(color.Output, "\t%s\n", lnutil.Header("Channels:"))
}

fmt.Fprintf(color.Output, "\t%s\n", lnutil.Header("Channels:"))

coinDaemonConnected := map[uint32]bool{}
for _, walBal := range bReply.Balances {
Expand Down Expand Up @@ -634,7 +620,7 @@ func printHelp(commands []*Command) {
func printCointypes() {
for k, v := range coinparam.RegisteredNets {
fmt.Fprintf(color.Output, "CoinType: %s\n", strconv.Itoa(int(k)))
fmt.Fprintf(color.Output, "└────── Name: %-13sBech32Prefix: %s\n\n", v.Name+",", v.Bech32Prefix)
fmt.Fprintf(color.Output, "└────── Name: %-13s, Bech32Prefix: %s\n\n", v.Name, v.Bech32Prefix)
}
}

Expand Down