Skip to content

Commit b6bd882

Browse files
committed
feature: reveal multiple items in dir
1 parent 590f888 commit b6bd882

File tree

10 files changed

+19
-100
lines changed

10 files changed

+19
-100
lines changed

plugins/opener/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<!-- description -->
44

5-
| Platform | Supported | Notes |
6-
| -------- | --------- | ----- |
7-
| Linux || |
8-
| Windows || |
9-
| macOS || |
10-
| Android | ? | |
11-
| iOS | ? | |
5+
| Platform | Supported |
6+
| -------- | --------- |
7+
| Linux ||
8+
| Windows ||
9+
| macOS ||
10+
| Android | ? |
11+
| iOS | ? |
1212

1313
## Install
1414

@@ -77,7 +77,8 @@ await openPath('/path/to/file', 'firefox')
7777
await revealItemInDir('/path/to/file')
7878

7979
// Reveal multiple paths with the system's default explorer
80-
await revealItemsInDir(['/path/to/file', '/path/to/another/file'])
80+
// Note: will be renamed to `revealItemsInDir` in the next major version
81+
await revealItemInDir(['/path/to/file', '/path/to/another/file'])
8182
```
8283

8384
### Usage from Rust

plugins/opener/api-iife.js

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

plugins/opener/build.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ fn _f() {
110110
};
111111
}
112112

113-
const COMMANDS: &[&str] = &[
114-
"open_url",
115-
"open_path",
116-
"reveal_item_in_dir",
117-
"reveal_items_in_dir",
118-
];
113+
const COMMANDS: &[&str] = &["open_url", "open_path", "reveal_item_in_dir"];
119114

120115
fn main() {
121116
tauri_plugin::Builder::new(COMMANDS)

plugins/opener/guest-js/index.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,14 @@ export async function openPath(path: string, openWith?: string): Promise<void> {
8686
* ```typescript
8787
* import { revealItemInDir } from '@tauri-apps/plugin-opener';
8888
* await revealItemInDir('/path/to/file');
89+
* await revealItemInDir([ '/path/to/file', '/path/to/another/file' ]);
8990
* ```
9091
*
9192
* @param path The path to reveal.
9293
*
9394
* @since 2.0.0
9495
*/
95-
export async function revealItemInDir(path: string) {
96-
return invoke('plugin:opener|reveal_item_in_dir', { path })
97-
}
98-
99-
/**
100-
* Reveal paths with the system's default explorer.
101-
*
102-
* #### Platform-specific:
103-
*
104-
* - **Android / iOS:** Unsupported.
105-
*
106-
* @example
107-
* ```typescript
108-
* import { revealItemsInDir } from '@tauri-apps/plugin-opener';
109-
* await revealItemsInDir(['/path/to/file']);
110-
* ```
111-
*
112-
* @param paths The paths to reveal.
113-
*
114-
* @since 2.0.0
115-
*/
116-
export async function revealItemsInDir(paths: string[]) {
117-
return invoke('plugin:opener|reveal_items_in_dir', { paths })
96+
export async function revealItemInDir(path: string | string[]): Promise<void> {
97+
const paths = typeof path === 'string' ? [ path ] : path
98+
return invoke('plugin:opener|reveal_item_in_dir', { paths })
11899
}

plugins/opener/permissions/autogenerated/commands/reveal_items_in_dir.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

plugins/opener/permissions/autogenerated/reference.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ as well as reveal file in directories using default file explorer
77

88
- `allow-open-url`
99
- `allow-reveal-item-in-dir`
10-
- `allow-reveal-items-in-dir`
1110
- `allow-default-urls`
1211

1312
## Permission Table
@@ -107,32 +106,6 @@ Enables the reveal_item_in_dir command without any pre-configured scope.
107106

108107
Denies the reveal_item_in_dir command without any pre-configured scope.
109108

110-
</td>
111-
</tr>
112-
113-
<tr>
114-
<td>
115-
116-
`opener:allow-reveal-items-in-dir`
117-
118-
</td>
119-
<td>
120-
121-
Enables the reveal_items_in_dir command without any pre-configured scope.
122-
123-
</td>
124-
</tr>
125-
126-
<tr>
127-
<td>
128-
129-
`opener:deny-reveal-items-in-dir`
130-
131-
</td>
132-
<td>
133-
134-
Denies the reveal_items_in_dir command without any pre-configured scope.
135-
136109
</td>
137110
</tr>
138111
</table>

plugins/opener/permissions/default.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ as well as reveal file in directories using default file explorer"""
66
permissions = [
77
"allow-open-url",
88
"allow-reveal-item-in-dir",
9-
"allow-reveal-items-in-dir",
109
"allow-default-urls",
1110
]

plugins/opener/permissions/schemas/schema.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -337,22 +337,10 @@
337337
"markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope."
338338
},
339339
{
340-
"description": "Enables the reveal_items_in_dir command without any pre-configured scope.",
341-
"type": "string",
342-
"const": "allow-reveal-items-in-dir",
343-
"markdownDescription": "Enables the reveal_items_in_dir command without any pre-configured scope."
344-
},
345-
{
346-
"description": "Denies the reveal_items_in_dir command without any pre-configured scope.",
347-
"type": "string",
348-
"const": "deny-reveal-items-in-dir",
349-
"markdownDescription": "Denies the reveal_items_in_dir command without any pre-configured scope."
350-
},
351-
{
352-
"description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-reveal-items-in-dir`\n- `allow-default-urls`",
340+
"description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`",
353341
"type": "string",
354342
"const": "default",
355-
"markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-reveal-items-in-dir`\n- `allow-default-urls`"
343+
"markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`"
356344
}
357345
]
358346
}

plugins/opener/src/commands.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,8 @@ pub async fn open_path<R: Runtime>(
6969
}
7070
}
7171

72+
/// TODO: in the next major version, rename to `reveal_items_in_dir`
7273
#[tauri::command]
73-
pub async fn reveal_item_in_dir(path: PathBuf) -> crate::Result<()> {
74-
crate::reveal_item_in_dir(path)
75-
}
76-
77-
#[tauri::command]
78-
pub async fn reveal_items_in_dir(paths: Vec<PathBuf>) -> crate::Result<()> {
74+
pub async fn reveal_item_in_dir(paths: Vec<PathBuf>) -> crate::Result<()> {
7975
crate::reveal_items_in_dir(&paths)
8076
}

plugins/opener/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ impl Builder {
222222
commands::open_url,
223223
commands::open_path,
224224
commands::reveal_item_in_dir,
225-
commands::reveal_items_in_dir,
226225
]);
227226

228227
if self.open_js_links_on_click {

0 commit comments

Comments
 (0)