Skip to content

Commit 5252342

Browse files
committed
feat(cli-rs): add cli-rs
1 parent 2ab2591 commit 5252342

9 files changed

Lines changed: 147 additions & 1 deletion

File tree

docs/cli-rs/00-readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Filen CLI
2+
3+
📩 [Releases](https://github.com/FilenCloudDienste/filen-cli-releases/releases) | 📖 [Documentation](https://docs.filen.io/docs/cli-rs/readme) | 📜 [Source](https://github.com/FilenCloudDienste/filen-rs/tree/main/filen-cli)
4+
5+
This is a Rust rewrite of [FilenCloudDienste/filen-cli](https://github.com/FilenCloudDienste/filen-cli).
6+
7+
> [!WARNING]
8+
> This project is in active development and still missing most functionality. **Don't use it.**
9+
10+
This rewrite aims to improve the Filen CLI in multiple ways:
11+
- Significantly reduced download size from up to 130MB to ~5MB.
12+
- Significantly improved performance, especially startup performance, which is critical for CLI applications (because we're using Rust instead of TypeScript).

docs/cli-rs/01-usage.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Usage
2+
3+
Welcome to the Filen CLI!
4+
5+
Invoke the Filen CLI with no command specified to enter interactive mode.
6+
There, you can specify absolute paths (starting with "/") or relative paths (supports "." and "..").
7+
8+
> `help [COMMAND_OR_TOPIC]`
9+
> Print help about a command or topic (default: general help)
10+
> 🠊 `[COMMAND_OR_TOPIC]` Command or topic to show help about
11+
12+
> `exit`
13+
> Exit the REPL
14+
15+
## Updates
16+
17+
The updater checks for new releases from https://github.com/FilenCloudDienste/filen-cli-releases
18+
when the CLI is run (unless skipped in the 5mins since the last check, or through the `--skip-update` flag).
19+
The executable will be replaced in place, with the filename updated if it contains the version number.
20+
21+
## Mounting
22+
23+
> `mount [MOUNT_POINT]`
24+
> Mount Filen as a network drive
25+
> 🠊 `[MOUNT_POINT]` Where to mount the network drive (default: system default)

docs/cli-rs/02-auth.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Authentication
2+
3+
There are multiple ways to authenticate:
4+
- set the CLI arguments `--email` and `--password` (optionally `--two-factor-code`)
5+
- specify an auth config via the `--auth-config-path` flag
6+
(exported) via `filen export-auth-config`
7+
- set environment variables (`FILEN_CLI_EMAIL` and `FILEN_CLI_PASSWORD`)
8+
- if none of these is set, you will be prompted for credentials
9+
with the option to save them securely in the system keychain
10+
11+
> `export-auth-config`
12+
> Export an auth config (to be used with --auth-config-path option)
13+
14+
> `logout`
15+
> Delete saved credentials and exit

docs/cli-rs/03-access-files.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Accessing Files
2+
3+
> `cd <DIRECTORY>`
4+
> Change the working directory (in REPL)
5+
> 🠊 `<DIRECTORY>` Directory to navigate into (supports "..")
6+
7+
> `ls [DIRECTORY]`
8+
> List files in a directory
9+
> 🠊 `[DIRECTORY]` Directory to list files in (default: the current working directory)
10+
11+
> `cat <FILE>`
12+
> Print the contents of a file
13+
> 🠊 `<FILE>` File to print
14+
15+
> `head [OPTIONS] <FILE>`
16+
> Print the first lines of a file
17+
> 🠊 `<FILE>` File to print
18+
> 🠊 `-n, --lines <LINES>` Number of lines to print [default: 10]
19+
20+
> `tail [OPTIONS] <FILE>`
21+
> Print the last lines of a file
22+
> 🠊 `<FILE>` File to print
23+
> 🠊 `-n, --lines <LINES>` Number of lines to print [default: 10]
24+
25+
> `stat <FILE_OR_DIRECTORY>`
26+
> Show information about a file, a directory or the Filen drive
27+
> 🠊 `<FILE_OR_DIRECTORY>` File or directory to show information about ("/" for the Filen drive)
28+
29+
> `mkdir <DIRECTORY>`
30+
> Create a new directory
31+
> 🠊 `<DIRECTORY>` Directory to create
32+
33+
> `rm [OPTIONS] <FILE_OR_DIRECTORY>`
34+
> Remove a file or directory
35+
> 🠊 `<FILE_OR_DIRECTORY>` File or directory to remove
36+
> 🠊 `-p, --permanent` Permanently delete the file or directory (default: move to trash)
37+
38+
> `mv <SOURCE> <DESTINATION>`
39+
> Move a file or directory
40+
> 🠊 `<SOURCE>` Source file or directory
41+
> 🠊 `<DESTINATION>` Destination parent directory
42+
43+
> `cp <SOURCE> <DESTINATION>`
44+
> Copy a file or directory
45+
> 🠊 `<SOURCE>` Source file or directory
46+
> 🠊 `<DESTINATION>` Destination parent directory
47+
48+
> `favorite <FILE_OR_DIRECTORY>`
49+
> Favorite a file or directory
50+
> 🠊 `<FILE_OR_DIRECTORY>` File or directory to favorite
51+
52+
> `unfavorite <FILE_OR_DIRECTORY>`
53+
> Unfavorite a file or directory
54+
> 🠊 `<FILE_OR_DIRECTORY>` File or directory to unfavorite
55+
56+
> `list-trash`
57+
> List trashed items with option to restore or permanently delete them
58+
59+
> `empty-trash`
60+
> Permanently delete all trashed items

docs/cli-rs/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "CLI (RS)",
3+
"position": 10,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Documentation of the Filen CLI (Rust)."
7+
}
8+
}

docusaurus.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { themes as prismThemes } from "prism-react-renderer"
22
import { type Config } from "@docusaurus/types"
33
import type * as Preset from "@docusaurus/preset-classic"
44
import type * as OpenAPIPreset from "docusaurus-preset-openapi"
5+
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives"
56

67
const config: Config = {
78
title: "Filen Docs",
@@ -54,7 +55,8 @@ const config: Config = {
5455
},
5556
docs: {
5657
sidebarPath: "./sidebars.ts",
57-
routeBasePath: "/docs"
58+
routeBasePath: "/docs",
59+
beforeDefaultRemarkPlugins: [remarkGithubAdmonitionsToDirectives]
5860
},
5961
theme: {
6062
customCss: "./src/css/custom.css"

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"prism-react-renderer": "^2.3.0",
2525
"react": "^18.0.0",
2626
"react-dom": "^18.0.0",
27+
"remark-github-admonitions-to-directives": "^2.1.0",
2728
"url": "^0.11.4"
2829
},
2930
"devDependencies": {

sidebars.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ const sidebars: SidebarsConfig = {
4747
type: "autogenerated",
4848
dirName: "mobile"
4949
}
50+
],
51+
// not yet released, so hiding it from the top navbar for now
52+
cliRsSidebar: [
53+
{
54+
type: "autogenerated",
55+
dirName: "cli-rs"
56+
}
5057
]
5158
}
5259

0 commit comments

Comments
 (0)