Function libzettels::examples::generate_examples_with_index
source · [−]Expand description
Takes the path to a directory and creates a directory structure with set of example files and a sample config file inside it, indexes the files and saves the index.
The result can be represented as follows:
examples
└── Zettelkasten
└── file1.md
└── file2.md
└── file3.md
└── subdir
└── file4.md
└── file5.md
└── onlies
└── markdown-only.md
└── pure-yaml.yaml
└── .hiddendir
└── .hiddenfile2.txt
└── a-file.txt
└── .gitignore
└── .zettelsignore
└── config
└── libzettels.cfg.yaml
└── index.yaml
This is almost identical to the result of
generate_examples_with_config
(see there for details), except example/config/index.yaml
now actually exists.
Errors
std::io::Error
of theInvalidInput
kind if the provided path is not a directory or cannot be accessed.- A variety of other
std::io::Error
s for problems with creating and writing to the files in the directory.
Panics
- if the generated
Config
can’t be written to or read from file. This should only happen if something is wrong with the example data. In other words: it shouldn’t happen and is considered a bug. - if the generated files cannot be indexed, properly. This should only happen if something is wrong with the example data. In other words: it shouldn’t happen and is considered a bug.