Closed PythonLinks closed 4 years ago
I would definitely not bake this into rmate
itself, but instead write a wrapper script around mate
.
Your script would:
/tmp/my-object.txt
mate --wait /tmp/my-object.txt
Here’s the --help
output from mate
(which is more capable than rmate
):
mate 2.13.2 (Apr 21 2020)
Usage: mate [-wl<selection>t<filetype>m<name>rehv] [-u<identifier> | file ...]
mate [-c<mark>] -s<mark>:<value> -l<line> [-u<identifier> | file ...]
mate -c<mark> [-l<line>] [-u<identifier> | file ...]
Options:
-w, --[no-]wait Wait for file to be closed by TextMate.
-l, --line <selection> Setup <selection> after loading file.
-t, --type <filetype> Treat file as having <filetype>.
-m, --name <name> The display name shown in TextMate.
-r, --[no-]recent Add file to Open Recent menu.
-u, --uuid <identifier> Reference already open document with
<identifier>.
-e, --[no-]escapes Set this to preserve ANSI escapes from stdin.
-s, --set-mark <mark>[:<value>] Set a mark with optional <value> (requires --line).
-c, --clear-mark <mark> Clear a mark (clears all marks without --line).
-h, --help Show this information.
-v, --version Print version information.
Files opened via mate are added to the recent menu unless
the file starts with a period, --wait or --no-recent is
specified, or the file is in the system’s temporary directory.
By default mate will wait for files to be closed if the command name
has a "_wait" suffix (e.g. via a symbolic link) or when used as a
filter as in these examples:
ls *.tex|mate|sh -w implied
mate -|cat -n -w implied (read from stdin)
The -l/--line option requires a selection in the following format:
selection = <range> ('&' <range>)*
range = <pos> | <normal_range> | <column_range>
pos = <line> (':' <column>)? ('+' <offset>)?
normal_range = <pos> '-' <pos>
column_range = <pos> 'x' <pos>
line = [1-9][0-9]*
column = [1-9][0-9]*
offset = [1-9][0-9]*
Thank you for the awesome and fast answer.
LOL.
At first I was quite offended that it got closed so quickly, then I scrolled down to see your excellent, answer.
So it is really just a matter of syncing a local directory with a remote directory. Just the remote directory is served by http. That is conceptually a very simple problem.
So a quick search and I found this software.
https://pypi.org/project/dirsync/
If anyone should find this posting talk to me. By then I may well have written the software to accomplish this objective. I really want it.
I would like to use Textmate to edit content in a hierarchical CMS.
The problem is that the data is stored in an object-database, or in PostgreSQL rather than in a file system. We need to fetch the content, or write the content using https. Not access files using ssh. Fetch the contents of an object, write the contents, fetch the contents of a collection, move an object or collection and delete an object or collection. These are Python object in the database, with a name, some content, change time, file size, permissions, and content type. These objects are accessed with a path. Very much like a file system.
I suspect that a few small changes to rmate would accomplish what I want.
I could do this with the Python version of mate, but it is a bit out of date. The bash version is not so good at asynchronous operations. Ruby’s concurrency models look great.
Webdav is the other solution, but I think that rmate is much closer to what I want. For one thing Textmate already supports rmate. Just run CMSmate on the local machine and access the content over the web.
Has anyone else done something like this? Warm Regards Christopher Lozinski