mirror of
https://github.com/Drop-OSS/droplet.git
synced 2025-11-10 04:22:16 +10:00
feat: add list files command
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@drop-oss/droplet",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"napi": {
|
||||
@ -42,6 +42,6 @@
|
||||
},
|
||||
"packageManager": "yarn@4.7.0",
|
||||
"repository": {
|
||||
"url": "https://github.com/Drop-OSS/droplet"
|
||||
"url": "git+https://github.com/Drop-OSS/droplet.git"
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,3 +110,11 @@ pub fn has_backend_for_path(path: String) -> bool {
|
||||
|
||||
has_backend
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn list_files(path: String) -> Vec<String> {
|
||||
let path = Path::new(&path);
|
||||
let backend = create_backend_for_path(path).unwrap();
|
||||
let files = backend.list_files(path);
|
||||
files.into_iter().map(|e| e.relative_filename).collect()
|
||||
}
|
||||
Reference in New Issue
Block a user