mirror of
https://github.com/PeernetOfficial/Cmd.git
synced 2026-07-23 13:47:49 +01:00
Update to latest core library. Output errors for config and log.
This commit is contained in:
32
Main.go
32
Main.go
@@ -6,7 +6,37 @@ Author: Peter Kleissner
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/PeernetOfficial/core"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/PeernetOfficial/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
const configFile = "Settings.yaml"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if status, err := core.LoadConfig(configFile); err != nil {
|
||||||
|
switch status {
|
||||||
|
case 0:
|
||||||
|
fmt.Printf("Unknown error accessing config file '%s': %s", configFile, err.Error())
|
||||||
|
case 1:
|
||||||
|
fmt.Printf("Error reading config file '%s': %s", configFile, err.Error())
|
||||||
|
case 2:
|
||||||
|
fmt.Printf("Error parsing config file '%s' (make sure it is valid YAML format): %s", configFile, err.Error())
|
||||||
|
case 3:
|
||||||
|
fmt.Printf("Unknown error loading config file '%s': %s", configFile, err.Error())
|
||||||
|
}
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := core.InitLog(); err != nil {
|
||||||
|
fmt.Printf("Error opening log file: %s", err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
core.Init()
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
core.Connect()
|
core.Connect()
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -20,3 +20,23 @@ To build:
|
|||||||
```
|
```
|
||||||
go build
|
go build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Use
|
||||||
|
|
||||||
|
The settings filename is hard-coded to `Settings.yaml` and is created on the first run. Please see the core library for individual settings to change.
|
||||||
|
|
||||||
|
Simply start it and then use the listed commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
C:\Peernet\Cmd>Cmd
|
||||||
|
Peernet Cmd 0.1
|
||||||
|
------------------------------
|
||||||
|
Please enter a command:
|
||||||
|
help Show this help
|
||||||
|
net list Lists all network adapters and their IPs
|
||||||
|
status Get current status
|
||||||
|
chat Send text to all peers
|
||||||
|
peer list List current peers
|
||||||
|
debug key create Create Public-Private Key pair
|
||||||
|
debug key self List current Public-Private Key pair
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user