Rename get-local-path subcommand to get-path
This commit is contained in:
@@ -131,10 +131,10 @@ Mount options:
|
||||
Resolve a Docspell item ID or web URL to the local mounted path:
|
||||
|
||||
```bash
|
||||
docspell-cli get-local-path <item-id-or-web-url>
|
||||
docspell-cli get-path <item-id-or-web-url>
|
||||
```
|
||||
|
||||
`get-local-path` automatically starts the configured mount in the background if it is not mounted yet. If an existing mount is stale, the tool attempts to unmount it and start a fresh one.
|
||||
`get-path` automatically starts the configured mount in the background if it is not mounted yet. If an existing mount is stale, the tool attempts to unmount it and start a fresh one.
|
||||
|
||||
Resolve a local mounted path, item ID, or item URL to the Docspell web URL:
|
||||
|
||||
@@ -145,7 +145,7 @@ docspell-cli get-url <local-mounted-path-or-item-id>
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
docspell-cli get-local-path https://docspell.example.com/app/item/abc123
|
||||
docspell-cli get-path https://docspell.example.com/app/item/abc123
|
||||
docspell-cli get-url ~/mnt/docspell/Invoices/2026/07/example.pdf
|
||||
docspell-cli get-url abc123
|
||||
```
|
||||
|
||||
@@ -47,9 +47,9 @@ func main() {
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(os.Args) > 1 && os.Args[1] == "get-local-path" {
|
||||
if err := runGetLocalPathCommand(os.Args[2:], cfg, password); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "get-local-path failed:", err)
|
||||
if len(os.Args) > 1 && os.Args[1] == "get-path" {
|
||||
if err := runGetPathCommand(os.Args[2:], cfg, password); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "get-path failed:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -132,13 +132,13 @@ func startMountInBackground(args []string, mountPoint string, quiet bool) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func runGetLocalPathCommand(args []string, cfg config, password string) error {
|
||||
flags := flag.NewFlagSet("get-local-path", flag.ExitOnError)
|
||||
func runGetPathCommand(args []string, cfg config, password string) error {
|
||||
flags := flag.NewFlagSet("get-path", flag.ExitOnError)
|
||||
if err := flags.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if flags.NArg() != 1 {
|
||||
return fmt.Errorf("usage: %s get-local-path <item-id-or-url>", filepath.Base(os.Args[0]))
|
||||
return fmt.Errorf("usage: %s get-path <item-id-or-url>", filepath.Base(os.Args[0]))
|
||||
}
|
||||
mountPoint, err := ensureMounted(cfg, password)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user