Differences
This shows you the differences between the selected revisions of the page.
2020-02-07 | 2020-02-07 | ||
syntax highlighting for remote custom commands (martin) | we now have an extension for generating the HTTP URL (martin) | ||
Line 99: | Line 99: | ||
<code custom-command-remote> | <code custom-command-remote> | ||
chown -R "!?New owner:?!":"!?New group:?!" !& | chown -R "!?New owner:?!":"!?New group:?!" !& | ||
- | </code> | ||
- | |||
- | ===== [[url]] URL Address of Selected File ===== | ||
- | ==== Using Local Command ==== | ||
- | Example shows how to use local custom command that maps file path to URL. | ||
- | |||
- | <code custom-command-local>!`cmd /C echo @echo off > %TEMP%\url.bat & | ||
- | echo set FILE_PATH=%1 >> %TEMP%\url.bat & | ||
- | echo echo https://www.example.com%FILE_PATH:home/user/public_html=~user% >> %TEMP%\url.bat` | ||
- | cmd /C %TEMP%\url.bat !/! & pause</code> | ||
- | |||
- | Hints: | ||
- | |||
- | * Note that the above should be entered as one line! | ||
- | * Check custom command options //Local command// and //Use remote files//. | ||
- | * If you want to copy the %%URL%% to clipboard instead of displaying it, replace the trailing ''& pause'' with ''| clip''. | ||
- | * For your particular use, just replace ''%%https://www.example.com%%'' with right %%URL%% prefix, ''home/user/public_html'' with right path prefix and ''~user'' with right %%URL%% replacement (it can even be empty in some cases). | ||
- | |||
- | ==== Using Remote PHP Code ==== | ||
- | Example shows how to launch simple PHP script that maps file path to URL. | ||
- | |||
- | <code custom-command-remote> | ||
- | echo '<?="https://www.example.com".str_replace("home/user/public_html", "~user", "'`pwd`'")."/!\n"?>' | php -q | ||
- | </code> | ||
- | |||
- | Hints: | ||
- | |||
- | * Note that the above should be entered as one line! | ||
- | * Do not forget to check custom command option //Show results in terminal// or //Copy results to clipboard//, otherwise you will not get the results. You may also want to use the command for directories, check //Apply to directories// too. | ||
- | * For your particular use, just replace ''%%https://www.example.com%%'' with right URL prefix, ''home/user/public_html'' with right path prefix and ''~user'' with right %%URL%% replacement (it can even be empty in some cases). | ||
- | * If you do mapping like above, i.e. for server containing multiple user's homepages, you can make it universal by replacing ''user'' with ''%%'`whoami`'%%''. | ||
- | |||
- | ==== Using Remote Shell Code ==== | ||
- | |||
- | Another example using shell commands only, in case PHP is not available: | ||
- | |||
- | <code custom-command-remote> | ||
- | echo 'https://www.example.com'`pwd`'/!' | sed s#home/user/public_html#~user# | ||
</code> | </code> | ||