You are not logged in.
Tfman - text file manager.
Performs operations on files through textual representation of file system.
Textual representation is in the form of plain text, editable with any text
editor and may contain multiple operations of every kind. Tfman can be
used from command-line or from within Vim as multi-window file manager.
It can be combined with tools like Sed or Awk.
. written in C fo Unix-like operating systems
. no dependencies (except gcc/clang and GNU Make for building)
Features in short:
- scan filesystem to create its textual representation
- parse textual representation and perform retrieved operations
- use favorite text editing tool to edit textual representation
- scan, edit and parse in one step
- use Tfman from command-line or from within Vim as multi-window file manager
- integration with other decent text editors should be easy
- available: brace expansion, globbing, entries grouping, whole directory operations and more
Project's homepage:
https://chiselapp.com/user/machel/repository/tfman/home
Installation procedure (AUR or sources tarball) - see Project's homepage
Documentation, sources, report issue - see Project's homepage
Warning:
Tfman is in an early state, it didn't receive sufficient testing yet. Please
be carefull when manipulating sensitive data with it.
Note:
I do not know any file manager that manipulates file system in similar way.
Therefore usefulness of this kind of approach is not proven.
Help me prove it.
Screenshots:
New version pushed to AUR:
- changing entry ownership and permissions now associated under one action tag
- few other action tags changed
- Quick Start Guide now available, see Project's homepage
- bug fixes
Last edited by machel (2014-07-15 11:48:48)
Offline
The basic idea sounds quite compelling to me. Especially when used in pipeline with sed, awk or similar it could have the potential to make some complex tasks quite easy. Overall, it looks like a good start for a useful utility.
But... There is always some but :-) For me right now, it is the complexity of the syntax. I know it is not easy to simply describe all filesystem properties, but current state (judging from quickly reading the tutorial) is probably too komplex for me to remember.
Also, some more features I would like on tool like this would be ability to execute commands on the files/directories and to execute some actions conditionally.
Good luck with this project. I'll definitely keep an eye on it, hoping it'll become usable enough even for lazy people like me
Offline
Hi, thanks for reply.
This is exactly the feedback I was looking for - about basic idea and syntax. :-)
complexity of the syntax
I know it looks complex, but I believe it is not as complex as it seems to be although
not as simple as I want it to be. Any ideas how to make it simpler are highly appreciated.
Basically you have to remember only 3 things:
1) Each line you want to be parsed begin with 'effective tag', which describes type of entry:
SPACE or '|' - normal entry
'#': - directory, all entries (lines) below belong to it (it is prepended to their names)
there is also '$': - priority entry - executed before all other entries
For example:
inactive_entry NO EFFECTIVE TAG - ACTIONS WILL NOT BE PERFORMED FOR THIS LINE
entry_under_curent_working_dir space AS EFFECTIVE TAG, NO DIRECTORY ABOVE - $CWD WILL BE ASSUMED
# Dir
| entry_under_Dir
# Subdir1
| entry_under_Subdir
# SubdirB INDENTATION STEP IS DEFAULT 2 SPACES, BREAKING IT CAUSE PARSING ERROR
| entry_under_SubdirB SAME AS: #Dir/Subdir1/SubdirB/entry_under_SubdirB
# Subdir2 SAME AS: #Dir/Subdir2
entry_under_Subdir2 THIS TIME space USED AS EFFECTIVE TAG INSTEAD '|' - MATTER OF TASTE
# NewDir
# Subdir
etc...
Note that scanning already puts effective tags on place, so they are not a concern if
you are not creating textual representation yourself. You just add action tags.
2) Use action tags to specify operations. They apply to single entries, groups of entries or whole directories
For example:
entry_name >>move_here
# Dir == :change_user THANKS TO '==' IT WILL CHANGE USER OF Dir AND ALL ENTRIES UNDER IT (entry1, entry2)
{
entry1
entry2
} >copy_here COPY ALL GROUPPED ENTRIES (again entry1, entry2)
Remember that actions are performed type by type, not in order they appear in text. First all 'create' actions,
then 'copy', etc.
Priority lines '$' break this rule, actions specified in this kind of lines are executed before normal actions in order
they appear in text.
3) Entry names and action operands - I believe using them is quite intuitive:
Name relative to directory/subdirectory above:
'name'
If you want absolute name:
'/name'
If you want name relative to current working directory (where Tfman was invoked):
'./name'
ability to execute commands on the files/directories
What do you mean? Shell commands?
execute some actions conditionally
Interesting idea. I must think about it.
Tfman already have tags to stop parsing file, stop parsing line and goto next,
disable whole dir/group or single entry, exclude entry from under directory/group,
perform action on previous action's target, ignore errors.
But it works unconditionally.
--- Tfm ---
Remember about 'tfm' utility which is simple Tfman wrapper scanning given directory,
opening it in editor defined in EDITOR shell variable (Vim is default) and parsing
result after you save and quit.
It just compress 3 steps into 1.
--- Tfmvi ---
Vim plugin making Tfman usable from within this awesome editor.
You can open as many widnows as you want with directories or whole trees,
observe performed actions in common message window and have windows with directories
automatically updated.
Ofcourse you edit these windows as any other text.
Simple scanning history is implemented too.
I have defined few key mappings to automate some actions etc. but definitely more
is desired.
It will be improved soon because I find it usefull inside Vim as file manager.
Syntax highlighting is not perfect yet and probably not suitable for light background.
Good luck with this project.
Thanks a lot.
Last edited by machel (2014-07-16 06:00:27)
Offline
I know it looks complex, but I believe it is not as complex as it seems to be although
not as simple as I want it to be. Any ideas how to make it simpler are highly appreciated.
Well, for start: Is there really a reason to use different character for directory and its subdirectories? As far as I can tell, you could just use '%' for all directories and decide what is top-level directory and what is subdirectory based on the indentation. Also, it would be nice to reserve '#' for comments, as it is common in many languages.
2) Use action tags to specify operations. They apply to single entries, groups of entries or whole directories
Here the complexity begins. There is 13 operations, if I counted it correctly in the man page. To be fair, some of them are just adding '*' enforce overwrites. Fine, that leaves us with about 9 operations to learn. I could probably do that But it would be better if it was less... Would it be possible to simplify operations that don't affect file location by allowing user to simply change the value in the text representation? It would probably require some kind of header (or some clever trickery), because the order of columns is not fixed, but it might be worth the trouble. You could also extend this to changing file times and perhaps other properties (those from '-F proper'). The linking and moving operators look good, with little exception of '))' - that just looks odd to me
But that is definitely my personal taste... I'd prefer something like single '>'.
3) Entry names and action operands - I believe using them is quite intuitive:
Name relative to directory/subdirectory above:
'name'
If you want absolute name:
'/name'
If you want name relative to current working directory (where Tfman was invoked):
'./name'
No problem with this, I like that.
dolik.rce wrote:ability to execute commands on the files/directories
What do you mean? Shell commands?
Shell commands would be best, but generally just ability to execute command with given file/directory as input or parameter. Example usage would be something like this:
# Dir
file1 ^ sed -i -e 'some sed script here' becomes: sed -i -e 'some sed script here' < file1
file2 ^% touch % becomes: touch file2
The syntax is just an example, but in this case ^ would feed the file into the standard input of the command, and '^%' would replace '%' in commandline with the actual file name. For globing, command gets executed for each matching file.
dolik.rce wrote:execute some actions conditionally
Interesting idea. I must think about it.
Tfman already have tags to stop parsing file, stop parsing line and goto next,
disable whole dir/group or single entry, exclude entry from under directory/group,
perform action on previous action's target, ignore errors.
But it works unconditionally.
I can imagine wanting to do something based on the properties of file or even based on output of external command. E.g. 'move file only if it's older then N days', or 'ask remote server if it has file X, move the file to directory upload/ when the command returns non-zero exit status'
--- Tfm ---
Remember about 'tfm' utility which is simple Tfman wrapper scanning given directory,
opening it in editor defined in EDITOR shell variable (Vim is default) and parsing
result after you save and quit.
It just compress 3 steps into 1.
This is definitely handy, and probably only reasonable way to use tfman interactively. However, I'm not a vim-person - as I already said I'm lazy to remember anything, so you can imagine that learning enough vim commands to use it effectively would be a nightmare for me The same goes for tfmvi, I'm just not the target audience for that. But my EDITOR variable is usually set to nano, so I could easily use it with that, probably just with slightly more typing.
Offline
Well, for start: Is there really a reason to use different character for directory and its subdirectories?
Not at all. It is really a overlooked leftover. Thanks for making me realize that. First task to get into.
Would it be possible to simplify operations that don't affect file location by allowing user to simply change the value in the text representation?
I don't think so - big problem to detect if field is required to be changed. I was considering fixed order of fields and headers, but they do not offer flexibility the tags do. I may add headers anyway - detecting them will switch Tfman to 'headers mode'. Some people my find headers more convenient.
Shell commands would be best, but generally just ability to execute command with given file/directory as input or parameter.
I like the idea, it makes sense if user needs to execute commands on many files at once. It is not trivial though. I need to think about that.
I can imagine wanting to do something based on the properties of file or even based on output of external command. E.g. 'move file only if it's older then N days', or 'ask remote server if it has file X, move the file to directory upload/ when the command returns non-zero exit status'
Another good idea worth consideration, but it is the matter of rather distant future.
Offline
I do not know any file manager that manipulates file system in similar way.
Therefore usefulness of this kind of approach is not proven.
Help me prove it.
FYI something similar has long been available in Emacs: Dired (and, specifically, Wdired for being able to directly edit the contents of the buffer and having the results be translated back to the filesystem).
Offline
I use vidir from the moreutils package. And I use it quite often, it's really very handy!!
Offline
dolik.rce wrote:Well, for start: Is there really a reason to use different character for directory and its subdirectories?
Not at all. It is really a overlooked leftover. Thanks for making me realize that. First task to get into.
Done. Subdirectories ('%') removed, indented directories('#') got their role. Plus some bugs fixes which
I have never suspected to exist.
New release is already in AUR.
FYI something similar has long been available in Emacs: Dired (and, specifically, Wdired for being able to directly edit the contents of the buffer and having the results be translated back to the filesystem).
Didn't know about that, I do not use Emacs.
It looks like it has few usefull features like rename, move, delete and change link target, permissions change.
Thanks, I will definitely look deeper into this.
I use vidir from the moreutils package. And I use it quite often, it's really very handy!!
Didn't know about that as well.
I have seen presentation on youtube and it looks quite convenient to use,
some concepts are worth consideration. Thanks.
Offline
Trying out and using it for some time now, few issues posted on your web site. Great job, thanks...
Last edited by Zaplanincan (2015-01-23 20:17:38)
Offline