-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: r3drun3 <simone.ragonesi@sighup.io>
- Loading branch information
Showing
8 changed files
with
116 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# macos | ||
.DS_Store | ||
.DS_Store | ||
|
||
# Vs code | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var RelayCmd = &cobra.Command{ | ||
Use: "relay", | ||
Short: "Relay commands", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// package commands | ||
|
||
// import ( | ||
// "context" | ||
// "fmt" | ||
|
||
// "github.com/nbd-wtf/go-nostr/nip11" | ||
// "github.com/spf13/cobra" | ||
// ) | ||
|
||
// var infoCmd = &cobra.Command{ | ||
// Use: "info [RELAY]", | ||
// Short: "Retrieve relay information document (nip-11)", | ||
// Long: `The info subcommand retrieves the relay capabilities, administrative contacts, and various server attributes.`, | ||
// Args: cobra.ExactArgs(1), // Expects exactly 1 argument (relay name) | ||
// Run: func(cmd *cobra.Command, args []string) { | ||
// url := args[0] | ||
// data, err := nip11.Fetch(context.Background(), url) | ||
|
||
// if err != nil { | ||
// panic(err) | ||
// } | ||
// fmt.Println(data) | ||
|
||
// }, | ||
// } | ||
|
||
// func init() { | ||
// // Add the "info" subcommand to the "relay" command | ||
// relayCmd.AddCommand(infoCmd) | ||
// } | ||
|
||
package commands | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/nbd-wtf/go-nostr/nip11" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var relayInfoCmd = &cobra.Command{ | ||
Use: "info [RELAY]", | ||
Short: "Retrieve relay information document (nip-11)", | ||
Long: `The info subcommand retrieves the relay capabilities, administrative contacts, and various server attributes.`, | ||
Args: cobra.ExactArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
relay := args[0] | ||
data, err := nip11.Fetch(context.Background(), relay) | ||
if err != nil { | ||
panic(err) | ||
} | ||
fmt.Println("####################### RELAY INFO #######################") | ||
fmt.Println("NAME: ", data.Name) | ||
fmt.Println("DESCRIPTION: ", data.Description) | ||
fmt.Println("PUB KEY: ", data.PubKey) | ||
fmt.Println("CONTACT: ", data.Contact) | ||
fmt.Println("SUPPORTED NIPS: ", data.SupportedNIPs) | ||
fmt.Println("SOFTWARE: ", data.Software) | ||
fmt.Println("VERSION: ", data.Version) | ||
fmt.Println("LIMITATION: ", data.Limitation) | ||
fmt.Println("PAYMENTSURL: ", data.PaymentsURL) | ||
fmt.Println("##########################################################") | ||
|
||
}, | ||
} | ||
|
||
func init() { | ||
RelayCmd.AddCommand(relayInfoCmd) | ||
} |
This file was deleted.
Oops, something went wrong.