idea; fs2otl

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

idea; fs2otl

David J Patrick-2
yes it's a bit of a nutty idea, but it occurred to me as I was making
notes about elements and structures of a filesystem, that it would
probably be easy (for some HaX0r) to make a little script that would
walk a filesystem and output a VO formatted text file, that could then
be edited as text.

fs2otl ~/Documents/ > myDocs.otl

just a kooky thought I wanted to share,
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Noel Henson
On Sunday 06 September 2009, David J Patrick wrote:

> yes it's a bit of a nutty idea, but it occurred to me as I was making
> notes about elements and structures of a filesystem, that it would
> probably be easy (for some HaX0r) to make a little script that would
> walk a filesystem and output a VO formatted text file, that could then
> be edited as text.
>
> fs2otl ~/Documents/ > myDocs.otl
>
> just a kooky thought I wanted to share,
> djp
> _______________________________________________
> VimOutliner mailing list
> [hidden email]
> http://www.lists.vimoutliner.org/mailman/listinfo

LOL. I don't need anything like that but it IS cool.


Noel
--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Scott Scriven-2
In reply to this post by David J Patrick-2
* David J Patrick <[hidden email]> wrote:
> yes it's a bit of a nutty idea, ...
>
> fs2otl ~/Documents/ > myDocs.otl

This works:

( cd ~/Documents && find . \
    | sort \
    | perl -pe 's|^\./||; s|[^/]+/|\t|g;' ) \
    > myDocs.otl

Or, how about in script form as you described...  plus a header,
and checkboxes on each item:

#!/bin/sh
echo "$1"
echo "$1" | perl -pe 's/./-/g;'
cd "$1"
find . \
    | sort \
    | perl -pe 's|^\./||; s|[^/]+/|\t|g; s/([^\t])/[_] $1/;'

I don't think it's a nutty idea...  for like a decade, I've been
tossing around the idea of making a generic outliner which
supports several back end formats, one of which is files and
directories.  It just hasn't been important enough to bother.


-- Scott
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Steve Litt
On Monday 07 September 2009 04:29:00 Scott Scriven wrote:

> * David J Patrick <[hidden email]> wrote:
> > yes it's a bit of a nutty idea, ...
> >
> > fs2otl ~/Documents/ > myDocs.otl
>
> This works:
>
> ( cd ~/Documents && find . \
>
>     | sort \
>     | perl -pe 's|^\./||; s|[^/]+/|\t|g;' ) \
>     |
>     > myDocs.otl
>
> Or, how about in script form as you described...  plus a header,
> and checkboxes on each item:
>
> #!/bin/sh
> echo "$1"
> echo "$1" | perl -pe 's/./-/g;'
> cd "$1"
> find . \
>
>     | sort \
>     | perl -pe 's|^\./||; s|[^/]+/|\t|g; s/([^\t])/[_] $1/;'
>
> I don't think it's a nutty idea...  for like a decade, I've been
> tossing around the idea of making a generic outliner which
> supports several back end formats, one of which is files and
> directories.  It just hasn't been important enough to bother.

OK Scott,

Great work! For your next assignment, go the other way, from outline to
filesystem.

Creating an intelligent directory structure is a detailed planning activity
which is much easier to do, undo, change, and play with in VimOutliner.

I would envision being able to represent both directories and regular files.
Regular files could have child nodes indicating owner, group, permissions and
contents. The contents suboutline would have each of its main headlines be
flush left in the actual file.

This actually has some benefit. Directories and their contained files make an
excellent Unix method for configuration and for temporary information storage,
and Unix makes directory parsing pretty easy.

SteveT



Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
In reply to this post by Scott Scriven-2
Scott Scriven wrote:
> * David J Patrick <[hidden email]> wrote:
>> yes it's a bit of a nutty idea, ...
>>
>> fs2otl ~/Documents/ > myDocs.otl
>
> This works:
>
Brilliant Scott! responses with code are the BEST ;-)
If I wanted to play with the second one (which I do) would it walk the
tree from wherever I started it ?

> I don't think it's a nutty idea...  for like a decade, I've been
> tossing around the idea of making a generic outliner which
> supports several back end formats, one of which is files and
> directories.  It just hasn't been important enough to bother.

You mean you haven't got around to making a "vofm" ?
hmmph, just LAZY, I guess..
;-)
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
In reply to this post by Steve Litt
Steve Litt wrote:
> Great work! For your next assignment, go the other way, from outline to
> filesystem.
YIKES! I can imagine creating a directory structure that way, but the
files.. ?
>
> Creating an intelligent directory structure is a detailed planning activity
> which is much easier to do, undo, change, and play with in VimOutliner.
Which is what I was thinking when the "itch" struck.
>
> I would envision being able to represent both directories and regular files.
> Regular files could have child nodes indicating owner, group, permissions and
> contents. The contents suboutline would have each of its main headlines be
> flush left in the actual file.
and because you could annotate to your hearts content, and retain the
ability to edit any (text) file or execute any program from within vim,
means the resultant VO representation of the filesystem would be quite
useful.
>
> This actually has some benefit. Directories and their contained files make an
> excellent Unix method for configuration and for temporary information storage,
> and Unix makes directory parsing pretty easy.

So it's entirely possible, the only thing missing is.. skill and
motivation. (I possess neither)
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Scott Scriven-2
In reply to this post by David J Patrick-2
* David J Patrick <[hidden email]> wrote:
>>> fs2otl ~/Documents/ > myDocs.otl
> If I wanted to play with the second one (which I do) would it
> walk the tree from wherever I started it ?

It works exactly like your example.

> hmmph, just LAZY, I guess..

That may be true, but I doubt I'm going to spend the time
necessary to write it because I haven't needed it.


-- Scott
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Scott Scriven-2
In reply to this post by Steve Litt
* Steve Litt <[hidden email]> wrote:
> Great work! For your next assignment, go the other way, from
> outline to filesystem.

Heh.

This way is a simple text substitution.  The other way is quite a
bit of work, and the implementation details can get pretty messy.  
For example, how do you keep the nodes in the correct order?  And
if you've got a thousand items, what happens when you insert one
in the middle?  Do half the items get renamed/retagged?

There are also issues with handling node attributes, but that's
probably not relevant to VO because it can't handle that either.  
Basically I'm looking for a hierarchic database with the ability
to have different columns for each row.  ... something like XML,
except without XML's problems.


-- Scott
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Steve Litt
On Monday 07 September 2009 17:16:43 Scott Scriven wrote:
> * Steve Litt <[hidden email]> wrote:
> > Great work! For your next assignment, go the other way, from
> > outline to filesystem.
>
> Heh.
>
> This way is a simple text substitution.  The other way is quite a
> bit of work, and the implementation details can get pretty messy.
> For example, how do you keep the nodes in the correct order?  

You don't. I think it's pretty standard to assume no order for files in a
directory, or to assume they're in alpha order.

> And
> if you've got a thousand items, what happens when you insert one
> in the middle?  Do half the items get renamed/retagged?

If the 501th item is a sibling, nothing happens at all. If it's a parent,
yeah, the whole tree must be erased and be remade.

>
> There are also issues with handling node attributes, but that's
> probably not relevant to VO because it can't handle that either.

That would be as simple as a subheadline saying perms=771, user=slitt,
group=slitt etc.

:-)

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt


_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Noel Henson
On Monday 07 September 2009, Steve Litt wrote:
> On Monday 07 September 2009 17:16:43 Scott Scriven wrote:

[snip]

>
> You don't. I think it's pretty standard to assume no order for files in
> a directory, or to assume they're in alpha order.

Using raw fs commands, you will find that files are NOT in alphabetical
order. It is up to the application or higher-level calls to sort them. ls
does this for you.

>
> > And
> > if you've got a thousand items, what happens when you insert one
> > in the middle?  Do half the items get renamed/retagged?
>
> If the 501th item is a sibling, nothing happens at all. If it's a
> parent, yeah, the whole tree must be erased and be remade.

Does it? If the 501th item is new, it should simply be added. It would be
sorted into the correct place by re-reading and sorting the directory.

>
> > There are also issues with handling node attributes, but that's
> > probably not relevant to VO because it can't handle that either.
>
> That would be as simple as a subheadline saying perms=771, user=slitt,
> group=slitt etc.

That would work.

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
In reply to this post by Scott Scriven-2
Scott Scriven wrote:

> * David J Patrick <[hidden email]> wrote:
>>>> fs2otl ~/Documents/ > myDocs.otl
>> If I wanted to play with the second one (which I do) would it
>> walk the tree from wherever I started it ?
>
> It works exactly like your example.
>
>> hmmph, just LAZY, I guess..
>
> That may be true, but I doubt I'm going to spend the time
> necessary to write it because I haven't needed it.

of course not, Scott, VOFM is a fully nutty idea with dubious outcomes,
and it would take a crap-load of work while I doubt any of us would need
it. I only posed it as a curiosity, and your code is a bonus, thank you
for joining me on that diversion!
djp

to lazy to do something stoopid = smart
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
In reply to this post by Scott Scriven-2
Scott Scriven wrote:

> Or, how about in script form as you described...  plus a header,
> and checkboxes on each item:
>
> #!/bin/sh
> echo "$1"
> echo "$1" | perl -pe 's/./-/g;'
> cd "$1"
> find . \
>     | sort \
>     | perl -pe 's|^\./||; s|[^/]+/|\t|g; s/([^\t])/[_] $1/;'
>
> I don't think it's a nutty idea...  for like a decade, I've been
> tossing around the idea of making a generic outliner which
> supports several back end formats, one of which is files and
> directories.  It just hasn't been important enough to bother.

y'know, this is a delightful bit of code, Scott, and I think it should
really hang with the other post-processors. I can imagine a handful of
enhancements, but for now, it's like a shiny new toy.

what might be neat, (or not) is the ability run fs2otl to map and
checkbox your filesysyem, go through it checking boxes, and then to use
(future version of ;-) the script with an(y) executable like;
fs2otl cp /media/backup/
using VO and checkboxes to choose what files are fed to the executable.
but I'll admit, it's a bit of a solution looking for a problem.
djp

ps, what do you think of when I say "lshw2otl" ?
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
David J Patrick wrote:
> ps, what do you think of when I say "lshw2otl" ?

omigod !
lshw outputs (nearly) working vimmable outline formatting.. almost..
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
In reply to this post by David J Patrick-2
David J Patrick wrote:
> Scott Scriven wrote:
>
>> Or, how about in script form as you described...  plus a header, and
>> checkboxes on each item:
amazing

y'know what else would be neat ? (just shoot me now, there's no telling
how long this could go on) some sweet regex action and some switches, yeah !

if one could simply
fs2otl -t *.otl > master.otl
(the -t says "include all the text in all the text files", the *.otl is
obvious)

if we were making switches (which WE're not) then
-d for directories only
-c for checkboxen
-t for text included (could be part of a healthy back-up)

whew
thanks
djp


>>
>> #!/bin/sh
>> echo "$1"
>> echo "$1" | perl -pe 's/./-/g;'
>> cd "$1"
>> find . \
>>     | sort \
>>     | perl -pe 's|^\./||; s|[^/]+/|\t|g; s/([^\t])/[_] $1/;'
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
David J Patrick wrote:
> if we were making switches (which WE're not) then
> -d for directories only
> -c for checkboxen
> -t for text included (could be part of a healthy back-up)
-o for outlines only

see ? it's like idea spam, geez
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
David J Patrick wrote:
> David J Patrick wrote:
>> if we were making switches (which WE're not) then
>> -d for directories only
>> -c for checkboxen
>> -t for text included (could be part of a healthy back-up)
> -o for outlines only
-r for recursive (otherwise, not)

quite feature-rich for a fantasy, huh ?
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

David J Patrick-2
David J Patrick wrote:

> David J Patrick wrote:
>> David J Patrick wrote:
>>> if we were making switches (which WE're not) then
>>> -d for directories only
>>> -c for checkboxen
>>> -t for text included (could be part of a healthy back-up)
>> -o for outlines only
> -r for recursive (otherwise, not)
>
> quite feature-rich for a fantasy, huh ?

besides the neato factor of seeing your filesystem represented in your
favorite outliner, there is some genuine functionality here, at least
when it comes to text (otl, too) files; as the ability to edit the file
under the cursor, in vim, using a simple "gf", makes a text-file listing
of text files, very useful.
djp
_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Herbert Sitz
David J Patrick-2 wrote
besides the neato factor of seeing your filesystem represented in your
favorite outliner, there is some genuine functionality here, at least
when it comes to text (otl, too) files; as the ability to edit the file
under the cursor, in vim, using a simple "gf", makes a text-file listing
of text files, very useful.
djp
As a practical matter I think that usefulness would be better gotten by using the built in file browser (access via ':Explore' command), or alternatively one of the several dedicated add-on file manager/browser scripts for Vim, like NERDTree ( http://www.vim.org/scripts/script.php?script_id=1658 ) ; Vim_Explorer ( http://www.vim.org/scripts/script.php?script_id=1950 ), or others.  They offer way more functionality than simply browsing and opening files.

It is neat to see and think of the different ways VimOutliner outlines can used, though.

-- Herb

Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Noel Henson
On Wednesday 09 September 2009, hsitz wrote:

> David J Patrick-2 wrote:
> > besides the neato factor of seeing your filesystem represented in your
> > favorite outliner, there is some genuine functionality here, at least
> > when it comes to text (otl, too) files; as the ability to edit the
> > file under the cursor, in vim, using a simple "gf", makes a text-file
> > listing of text files, very useful.
> > djp
>
> As a practical matter I think that usefulness would be better gotten by
> using the built in file browser (access via ':Explore' command), or

Did you know about ,,f?

> alternatively one of the several dedicated add-on file manager/browser
> scripts for Vim, like NERDTree (
> http://www.vim.org/scripts/script.php?script_id=1658 ) ; Vim_Explorer (
> http://www.vim.org/scripts/script.php?script_id=1950 ), or others.  They
> offer way more functionality than simply browsing and opening files.
>
> It is neat to see and think of the different ways VimOutliner outlines
> can used, though.
>
> -- Herb

Along the lines of mixing outlines with files (and inter- intra-outline
linking), how about a path syntax:

[whatever.otl]
[~/active/master.otl]
[~/active/master.otl:ToDos]
[~/active/master.otl:243]
[~/bin/otl2html.py ~/master.otl exe]

Could be put anywhere in a heading or alone as the heading. It would be
easy to extract and process.

Just a thought.

Noel

--

------------------------------------------------------------------
  Noel Henson
  www.noels-lab.com Chips, firmware and embedded systems
  www.vimoutliner.org Work fast. Think well.

_______________________________________________
VimOutliner mailing list
[hidden email]
http://www.lists.vimoutliner.org/mailman/listinfo
Reply | Threaded
Open this post in threaded view
|

Re: idea; fs2otl

Herbert Sitz
Noel Henson wrote
On Wednesday 09 September 2009, hsitz wrote:
> David J Patrick-2 wrote:
> > besides the neato factor of seeing your filesystem represented in your
> > favorite outliner, there is some genuine functionality here, at least
> > when it comes to text (otl, too) files; as the ability to edit the
> > file under the cursor, in vim, using a simple "gf", makes a text-file
> > listing of text files, very useful.
> > djp
>
> As a practical matter I think that usefulness would be better gotten by
> using the built in file browser (access via ':Explore' command), or

Did you know about ,,f?
Nope, I'd missed that.  Good one.  -- Herb