BetterDiscord / BetterDiscord/cli

Improve validation of user provided path

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
22
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Currently `bdcli` expected the `--path` given by user matched in the discovered list of paths

https://github.com/BetterDiscord/cli/blob/a933d312d632af0eeb64a7c167dcdd7c9951ef04/cmd/install.go#L39

https://github.com/BetterDiscord/cli/blob/a933d312d632af0eeb64a7c167dcdd7c9951ef04/internal/discord/paths.go#L78

Which causing manual path would fail when the internal path resolution failed

```
$ bdcli install -p ~/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/
Error: could not find a valid Discord installation at ***/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/
Usage:
bdcli install [flags]

Aliases:
install, reinstall

Flags:
-c, --channel string Discord release channel (stable|ptb|canary) (default "stable")
-h, --help help for install
-p, --path string Path to a Discord installation

Global Flags:
--silent Suppress non-error output

could not find a valid Discord installation at ***/.config/discord/app-1.0.137/modules/discord_desktop_core-1/discord_desktop_core/
```
**Suggestion:**

Validate the `--path` by checking the existence of `package.json` or even the content of it

**Related to:** https://github.com/BetterDiscord/cli/issues/8#issuecomment-4393432539

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.