man tree
1 states:
-info
Prints file comments found in .info files. See .INFO FILES below for more information on the format of .info files.
and further
.INFO FILES
.info files are similiar to .gitignore files, if a .info file is found while scanning a directory it is read and added to a stack of .info information. Each file is composed of comments (lines starting with hash marks (#),) or wild-card patterns which may match a file relative to the directory the .info file is found in. If a file should match a pattern, the tab indented comment that follows the pattern is used as the file comment. A comment is terminated by a non-tab indented line. Multiple patterns, each to a line, may share the same comment.
Objective
Given the following directory structure:
tree
.
├── fileA.txt
├── fileB.txt
└── other_files
└── fileC.txt
I would like to create a an info file(s) that would enable me to get the following output
.
├── fileA.txt # Comments on file A read from info file
├── fileB.txt # Comments on file B read from info file
└── other_files
└── fileC.txt
Following the man
pages this should be possible but I can't find an example how such an info file should be created. (削除) I've identified one potentially relevant discussion (削除ここまで)2 but it's not clear to me what should be the structure of this .info
file so tree
can use it to populate outputs with additional comments.
1Version: tree v2.0.2 (c) 1996 - 2022 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro*
2 As discussed in the comments, the link is not pertinent to this question.
2 Answers 2
Example:
$ cat .info
a.jpg
blah blah
blih blih
*.jpg
jpeg picture
$ tree --info
.
├── a.jpg
│ ⎧ blah blah
│ ⎩ blih blih
├── a.png
├── b.jpg
│ { jpeg picture
├── b.png
└── foo.user
0 directories, 5 files
(with a TAB preceding the comments per the manual you quoted).
Here's an example of the structure of the .info file for the tree command and how tree uses it: enter image description here
-
2Thanks for posting, but please don't post images of text since that cannot be copied from. We also can't understand the format since it's an image and shown using some fancy tool that adds formatting. Can you show the actual text in the file so others can copy it to reproduce your answer?2024年04月18日 18:48:24 +00:00Commented Apr 18, 2024 at 18:48
.info
extension which contain markup language for theinfo
command..info
file just an oddity oftree
or are there other tools supporting it?