#path #translates #cli #translate #drive #shared #linux

app sp

This cli opens files from Windows paths and translates Linux paths to Windows paths

4 releases

0.1.3 Oct 19, 2020
0.1.2 Jun 21, 2020
0.1.1 Jun 19, 2020
0.1.0 Jun 19, 2020

#1724 in Filesystem

MIT/Apache

11KB
187 lines

sp (Single Path)

This cli was made because at work we use some shared drives. The OS usage in the company is split between Windows and Linux in favor of Windows. Because most people use Windows we share links to files like this:

 t:\igor\path\sccpre.cat-kim-jung-un-png-913514.png

If you are using linux opening these paths and linking them is a headache because we have paths like this:

/mnt/temp/igor/path/sccpre.cat-kim-jung-un-png-913514.png

This cli opens files from Windows paths and translates Linux paths to Windows paths. It should work for Windows users with Linux paths, but I never tried.

Dependencies

This cli was made using the Rust programming language, so you will need Rust to use it.

INSTALL RUST

Installation

$ cargo install sp

Usage

You can check the usage with these commands:

$ sp -h
$ sp --help

First you need to set some replace pairs to translate Windows to Linux.

$ sp -f 'p:\' -r '/mnt/public/'
$ sp --find 't:\' --replace '/mnt/temp/'

You can list the replace pairs with these commands:

$ sp -l
$ sp --list

To clear the replace pairs you run one of these:

$ sp -e
$ sp --empty

For opening files we use these commands:

$ sp -o 't:\igor\path\sccpre.cat-kim-jung-un-png-913514.png'
$ sp --open 't:\igor\path\sccpre.cat-kim-jung-un-png-913514.png'

To translate a path to Windows and copy it to the clipboard you can do this:

$ sp -t /mnt/temp/igor/path/sccpre.cat-kim-jung-un-png-913514.png
$ sp --translate /mnt/temp/igor/path/sccpre.cat-kim-jung-un-png-913514.png

Dependencies

~6–14MB
~177K SLoC