Skip to content

Commit 43a03d3

Browse files
committed
Clean up logs and readme
1 parent 836b669 commit 43a03d3

10 files changed

Lines changed: 181 additions & 37 deletions

File tree

README.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ A cross-platform command-line interface for installing, updating, and managing [
1111

1212
- 🚀 Easy installation and uninstallation of BetterDiscord
1313
- 🔄 Support for multiple Discord channels (Stable, PTB, Canary)
14+
- 🧭 Discover Discord installs and suggested paths
15+
- 🧩 Manage plugins and themes (list, install, update, remove)
16+
- 🛒 Browse and search the BetterDiscord store
1417
- 🖥️ Cross-platform support (Windows, macOS, Linux)
1518
- 📦 Available via npm for easy distribution
1619
- ⚡ Fast and lightweight Go binary
@@ -47,6 +50,14 @@ Download the latest release for your platform from the [releases page](https://g
4750

4851
## Usage
4952

53+
### Global Options
54+
55+
```bash
56+
bdcli --silent <command> # Suppress non-error output
57+
```
58+
59+
You can also set `BDCLI_SILENT=1` to silence output in automation.
60+
5061
### Install BetterDiscord
5162

5263
Install BetterDiscord to a specific Discord channel:
@@ -85,6 +96,60 @@ bdcli uninstall --path /path/to/Discord
8596
bdcli version
8697
```
8798

99+
### Update BetterDiscord
100+
101+
```bash
102+
bdcli update
103+
bdcli update --check
104+
```
105+
106+
### Show BetterDiscord Info
107+
108+
```bash
109+
bdcli info
110+
```
111+
112+
### Discover Discord Installs
113+
114+
```bash
115+
bdcli discover installs
116+
bdcli discover paths
117+
bdcli discover addons
118+
```
119+
120+
### Manage Plugins
121+
122+
```bash
123+
bdcli plugins list
124+
bdcli plugins info <name>
125+
bdcli plugins install <name|id|url>
126+
bdcli plugins update <name|id|url>
127+
bdcli plugins remove <name|id>
128+
```
129+
130+
### Manage Themes
131+
132+
```bash
133+
bdcli themes list
134+
bdcli themes info <name>
135+
bdcli themes install <name|id|url>
136+
bdcli themes update <name|id|url>
137+
bdcli themes remove <name|id>
138+
```
139+
140+
### Browse the Store
141+
142+
```bash
143+
bdcli store search <query>
144+
bdcli store show <id|name>
145+
146+
bdcli store plugins search <query>
147+
bdcli store plugins show <id|name>
148+
149+
bdcli store themes search <query>
150+
bdcli store themes show <id|name>
151+
```
152+
88153
### Shell Completions
89154

90155
```bash
@@ -100,6 +165,18 @@ bdcli --help
100165
bdcli [command] --help
101166
```
102167

168+
### Automation
169+
170+
For scripts and CI jobs, you can suppress non-error output:
171+
172+
```bash
173+
# One-off command
174+
bdcli --silent install --channel stable
175+
176+
# Environment variable (applies to all commands)
177+
BDCLI_SILENT=1 bdcli update
178+
```
179+
103180
### CLI Help Output
104181

105182
```
@@ -111,13 +188,20 @@ Usage:
111188
112189
Available Commands:
113190
completion Generate shell completions
191+
discover Discover Discord installations and related data
114192
help Help about any command
193+
info Displays information about BetterDiscord installation
115194
install Installs BetterDiscord to your Discord
195+
plugins Manage BetterDiscord plugins
196+
store Browse and search the BetterDiscord store
197+
themes Manage BetterDiscord themes
116198
uninstall Uninstalls BetterDiscord from your Discord
199+
update Update BetterDiscord to the latest version
117200
version Print the version number
118201
119202
Flags:
120-
-h, --help help for bdcli
203+
--silent Suppress non-error output
204+
-h, --help help for bdcli
121205
122206
Use "bdcli [command] --help" for more information about a command.
123207
```
@@ -235,6 +319,12 @@ task coverage
235319
.
236320
├── cmd/ # Cobra commands
237321
│ ├── install.go # Install command
322+
│ ├── update.go # Update command
323+
│ ├── info.go # Info command
324+
│ ├── discover.go # Discover command
325+
│ ├── plugins.go # Plugins commands
326+
│ ├── themes.go # Themes commands
327+
│ ├── store.go # Store commands
238328
│ ├── uninstall.go # Uninstall command
239329
│ ├── version.go # Version command
240330
│ └── root.go # Root command

cmd/info.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,9 @@ var infoCmd = &cobra.Command{
2424
return fmt.Errorf("BetterDiscord does not appear to be installed, try running 'bdcli install' first")
2525
}
2626

27-
buildinfo, err := bdinstall.ReadBuildinfo()
28-
if err != nil {
29-
return err
30-
}
31-
3227
output.Printf("📦 BetterDiscord Information:\n\n")
3328

34-
output.Printf(" Build Information:\n")
35-
output.Printf(" 🔹 Version: %s\n", output.FormatVersion(buildinfo.Version))
36-
output.Printf(" 🔹 Commit: %s\n", buildinfo.Commit)
37-
output.Printf(" 🔹 Branch: %s\n", buildinfo.Branch)
38-
output.Printf(" 🔹 Mode: %s\n\n", buildinfo.Mode)
39-
40-
output.Printf(" Installation Paths:\n")
41-
output.Printf(" 📁 Base: %s\n", bdinstall.Root())
42-
output.Printf(" ⚙️ Data: %s\n", bdinstall.Data())
43-
output.Printf(" 🔌 Plugins: %s\n", bdinstall.Plugins())
44-
output.Printf(" 🎨 Themes: %s\n", bdinstall.Themes())
29+
bdinstall.LogBuildinfo()
4530

4631
return nil
4732
},

cmd/install.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@ var installCmd = &cobra.Command{
5454
}
5555

5656
output.Printf("✅ BetterDiscord installed to %s\n", path.Dir(install.CorePath))
57+
output.Blank()
58+
output.Printf("📋 Installation Summary:\n")
59+
output.Blank()
60+
output.Printf(" Release Channel: %s\n", install.Channel.Display())
61+
output.Printf(" Discord Version: %s\n", install.Version)
62+
output.Printf(" Install Type: %s\n", func() string {
63+
if install.IsFlatpak {
64+
return "flatpak"
65+
} else if install.IsSnap {
66+
return "snap"
67+
}
68+
return "native"
69+
}())
70+
output.Printf(" Core Path: %s\n", path.Dir(install.CorePath))
71+
output.Blank()
72+
73+
bdinstall := install.GetBetterDiscordInstall()
74+
bdinstall.LogBuildinfo()
5775
return nil
5876
},
5977
}

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var rootCmd = &cobra.Command{
5959
output.SetWriters(io.Discard, nil)
6060
}
6161
},
62-
RunE: func(cmd *cobra.Command, args []string) error { return cmd.Help() },
62+
RunE: func(cmd *cobra.Command, args []string) error { return cmd.Help() },
6363
}
6464

6565
func isSilentEnvEnabled() bool {

internal/betterdiscord/buildinfo.go

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"regexp"
77

8+
"github.com/betterdiscord/cli/internal/output"
89
"github.com/betterdiscord/cli/internal/utils"
910
)
1011

@@ -15,14 +16,23 @@ type Buildinfo struct {
1516
Mode string
1617
}
1718

19+
func NewBuildinfo() Buildinfo {
20+
return Buildinfo{
21+
Version: "unknown",
22+
Commit: "unknown",
23+
Branch: "unknown",
24+
Mode: "unknown",
25+
}
26+
}
27+
1828
func (i *BDInstall) ReadBuildinfo() (bi Buildinfo, err error) {
1929
if !utils.Exists(i.asar) {
20-
return Buildinfo{}, os.ErrNotExist
30+
return NewBuildinfo(), os.ErrNotExist
2131
}
2232

2333
f, err := os.Open(i.asar)
2434
if err != nil {
25-
return Buildinfo{}, err
35+
return NewBuildinfo(), err
2636
}
2737

2838
defer func() {
@@ -44,7 +54,7 @@ func (i *BDInstall) ReadBuildinfo() (bi Buildinfo, err error) {
4454
"mode": modeRe,
4555
}
4656

47-
buildinfo := Buildinfo{}
57+
buildinfo := NewBuildinfo()
4858
reader := bufio.NewReader(f)
4959

5060
// 64 KB chunks are a nice balance
@@ -95,3 +105,22 @@ func (i *BDInstall) ReadBuildinfo() (bi Buildinfo, err error) {
95105
i.Buildinfo = buildinfo
96106
return buildinfo, nil
97107
}
108+
109+
func (bdinstall *BDInstall) LogBuildinfo() {
110+
output.Printf("📦 BetterDiscord Information:\n")
111+
112+
buildinfo, err := bdinstall.ReadBuildinfo()
113+
if err == nil {
114+
output.Printf(" Build Information:\n")
115+
output.Printf(" 🔹 Version: %s\n", buildinfo.Version)
116+
output.Printf(" 🔹 Commit: %s\n", buildinfo.Commit)
117+
output.Printf(" 🔹 Branch: %s\n", buildinfo.Branch)
118+
output.Printf(" 🔹 Mode: %s\n", buildinfo.Mode)
119+
}
120+
121+
output.Printf(" Installation Paths:\n")
122+
output.Printf(" 📁 Base: %s\n", bdinstall.Root())
123+
output.Printf(" ⚙️ Data: %s\n", bdinstall.Data())
124+
output.Printf(" 🔌 Plugins: %s\n", bdinstall.Plugins())
125+
output.Printf(" 🎨 Themes: %s\n", bdinstall.Themes())
126+
}

internal/betterdiscord/download.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ func (i *BDInstall) download() error {
1717
resp, err := utils.DownloadFile("https://betterdiscord.app/Download/betterdiscord.asar", i.asar)
1818
if err == nil {
1919
version := resp.Header.Get("x-bd-version")
20-
output.Printf("✅ Downloaded BetterDiscord version %s from the official website\n", output.FormatVersion(version))
20+
if version == "" {
21+
output.Println("✅ Downloaded BetterDiscord from the official website")
22+
} else {
23+
output.Printf("✅ Downloaded BetterDiscord version %s from the official website\n", output.FormatVersion(version))
24+
}
2125
i.hasDownloaded = true
2226
return nil
2327
} else {
@@ -63,7 +67,11 @@ func (i *BDInstall) download() error {
6367
return err
6468
}
6569

66-
output.Printf("✅ Downloaded BetterDiscord version %s from GitHub\n", output.FormatVersion(version))
70+
if version == "" {
71+
output.Println("✅ Downloaded BetterDiscord from GitHub")
72+
} else {
73+
output.Printf("✅ Downloaded BetterDiscord version %s from GitHub\n", output.FormatVersion(version))
74+
}
6775
i.hasDownloaded = true
6876

6977
return nil

internal/betterdiscord/install.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ func New(root string) *BDInstall {
111111
plugins: filepath.Join(root, "plugins"),
112112
themes: filepath.Join(root, "themes"),
113113
hasDownloaded: false,
114-
Buildinfo: Buildinfo{
115-
Version: "unknown",
116-
Commit: "unknown",
117-
Branch: "unknown",
118-
Mode: "unknown",
119-
},
114+
Buildinfo: NewBuildinfo(),
120115
}
121116
}

internal/discord/install.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ type DiscordInstall struct {
1818

1919
// InstallBD installs BetterDiscord into this Discord installation
2020
func (discord *DiscordInstall) InstallBD() error {
21-
// Gets the global BetterDiscord install
22-
bd := betterdiscord.GetInstallation()
23-
24-
// Snaps get their own local BD install
25-
if discord.IsSnap {
26-
bd = betterdiscord.GetInstallation(filepath.Clean(filepath.Join(discord.CorePath, "..", "..", "..", "..")))
27-
}
21+
bd := discord.GetBetterDiscordInstall()
2822

2923
// Make BetterDiscord folders
3024
output.Println("🛠 Preparing BetterDiscord...")
@@ -97,3 +91,15 @@ func (discord *DiscordInstall) RepairBD() error {
9791

9892
return nil
9993
}
94+
95+
func (discord *DiscordInstall) GetBetterDiscordInstall() *betterdiscord.BDInstall {
96+
// Gets the global BetterDiscord install
97+
bd := betterdiscord.GetInstallation()
98+
99+
// Snaps get their own local BD install
100+
if discord.IsSnap {
101+
bd = betterdiscord.GetInstallation(filepath.Clean(filepath.Join(discord.CorePath, "..", "..", "..", "..")))
102+
}
103+
104+
return bd
105+
}

internal/discord/process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func (discord *DiscordInstall) restart() error {
1313
exeName := discord.getFullExe()
1414

1515
if running, _ := discord.isRunning(); !running {
16-
output.Printf("✅ %s is not running.\n", discord.Channel.Name())
16+
output.Printf("✅ %s is not running; skipping restart.\n", discord.Channel.Name())
1717
return nil
1818
}
1919

internal/models/channel.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ func (channel DiscordChannel) String() string {
3030
return ""
3131
}
3232

33+
// Display returns the display name of the Discord channel
34+
func (channel DiscordChannel) Display() string {
35+
switch channel {
36+
case Stable:
37+
return "Stable"
38+
case Canary:
39+
return "Canary"
40+
case PTB:
41+
return "PTB"
42+
}
43+
return ""
44+
}
45+
3346
// Used for user display
3447
func (channel DiscordChannel) Name() string {
3548
switch channel {

0 commit comments

Comments
 (0)