Skip to content

Commit 6b21a90

Browse files
committed
doc, bump
1 parent b8d6dc6 commit 6b21a90

5 files changed

Lines changed: 55 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# Change Log
22

3-
## [unreleased]
3+
## [0.13.0]
44

55
### Added
66

77
- Added `edit` subcommand that opens `version.toml` in default editor.
8+
- Added `init` subcommand that try to find and add existing plugins to config
9+
10+
### Fixed
11+
12+
- Fixed `pin remove`.
813

914
## [0.12.0]
1015

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ptr"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
edition = "2021"
55

66
[dependencies]

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,33 @@ cargo install --git https://github.com/8LWXpg/ptr.git
2424

2525
## Quick Start
2626

27+
### For New Plugins
28+
2729
Install a plugin with `add`:
2830

2931
```
3032
ptr add GitHubRepo 8LWXpg/PowerToysRun-GitHubRepo
3133
```
3234

35+
### For Existing Plugins
36+
37+
Add existing plugins with `init`:
38+
39+
```
40+
ptr init
41+
```
42+
43+
> [!NOTE]
44+
> This overrides existing config
45+
46+
Then update with
47+
48+
```
49+
ptr update --all
50+
```
51+
52+
### Useful tips
53+
3354
A config file will be created at `%LOCALAPPDATA%\Microsoft\PowerToys\PowerToys Run\Plugins\version.toml`. While not necessary, you can manually modify it if desired. For the generated config structure, refer to [`test.toml`](./test/test.toml).
3455

3556
Check result with `list`:
@@ -68,13 +89,15 @@ PowerToys Run Plugin Manager
6889
Usage: ptr.exe <COMMAND>
6990
7091
Commands:
92+
init Try to find and add existing plugins to config
7193
add Add a plugin [aliases: a]
7294
update Update plugins [aliases: u]
7395
remove Remove plugins [aliases: r]
7496
list List all installed plugins [aliases: l]
7597
pin Pin plugins so it's not updated with `update --all` [aliases: p]
7698
import Import plugins from configuration file [aliases: i]
7799
restart Restart PowerToys
100+
edit Open config file in default editor
78101
self-update Self update to latest
79102
completion Generate shell completion (PowerShell)
80103
help Print this message or the help of the given subcommand(s)
@@ -84,6 +107,17 @@ Options:
84107
-V, --version Print version
85108
```
86109

110+
### Init
111+
112+
```init --help
113+
Try to find and add existing plugins to config
114+
115+
Usage: ptr.exe init
116+
117+
Options:
118+
-h, --help Print help
119+
```
120+
87121
### Add
88122

89123
```add --help
@@ -197,6 +231,12 @@ Options:
197231
Usage: ptr.exe restart
198232
```
199233

234+
### Edit
235+
236+
```
237+
Usage: ptr.exe edit
238+
```
239+
200240
### Self Update
201241

202242
```

src/config.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::fs;
88
use std::io::Write;
99
use std::path::PathBuf;
1010
use tabwriter::TabWriter;
11-
use windows::Win32::UI::Shell::COMP_ELEM_SIZE_HEIGHT;
1211

1312
use crate::polling;
1413
use crate::util::{get_powertoys_path, kill_ptr, start_ptr};
@@ -72,7 +71,7 @@ impl Config {
7271
.filter(|e| e.path().is_dir())
7372
.filter_map(|d| {
7473
let path = d.path();
75-
let dir_name = path.file_name()?.to_string_lossy().to_string();
74+
let dir_name = path.file_name()?.to_str()?;
7675
let metadata_path = path.join("plugin.json");
7776
if !metadata_path.exists() {
7877
return None;
@@ -88,19 +87,22 @@ impl Config {
8887
let metadata: PluginMetadata = serde_json::from_str(&content)
8988
.inspect_err(|e| {
9089
error!(format!(
91-
"failed to deserialize {}/plugin.json: {}",
90+
"failed to deserialize '{}/plugin.json': {}",
9291
dir_name, e
9392
))
9493
})
9594
.ok()?;
9695
Some((
97-
dir_name,
96+
dir_name.into(),
9897
Plugin {
9998
repo: metadata
10099
.website
101100
.strip_prefix("https://github.com/")
102101
.or_else(|| {
103-
error!(format!("invalid website url: {}", metadata.website));
102+
error!(format!(
103+
"invalid website url in {}: '{}'",
104+
dir_name, metadata.website
105+
));
104106
None
105107
})?
106108
.to_string(),

0 commit comments

Comments
 (0)