56 std::vector<std::filesystem::path> removed_files;
57 std::vector<std::filesystem::path> removed_directories;
62 return removed_files.size() + removed_directories.size();
86 std::filesystem::path start_dir = std::filesystem::current_path());
96 const std::filesystem::path& start_dir);
100 const std::filesystem::path&
root_dir() const noexcept {
140 static Manager init(
const std::filesystem::path& target_dir,
184 bool dry_run =
false);
293 bool reset(
bool force =
false);
328 const std::filesystem::path& config_file);
330 std::filesystem::path root_dir_;
Represents a single NoTeX project: its location and metadata.
bool delete_scaffolding(bool remove_all=false, bool force=false)
Removes NoTeX's own scaffolding from the project.
const std::filesystem::path & root_dir() const noexcept
void add_bibliography()
Adds a bibliography.
std::vector< std::string > orphan_sections() const
static CleanReport clean(const std::filesystem::path &start_dir, bool dry_run=false)
Recursively removes known LaTeX build artefacts from start_dir.
std::vector< std::filesystem::path > project_files() const
void set_config_value(std::string_view key, std::string_view value)
Sets a single whitelisted metadata key directly.
static std::optional< std::filesystem::path > find_project_root(const std::filesystem::path &start_dir)
Searches upward from start_dir for a .notex/ directory, without requiring one to exist.
void save() const
Persists the current metadata back to .notex/notex.json.
void add_section(std::string_view title)
Adds a new section titled title.
void remove_bibliography()
Removes the bibliography commands added by add_bibliography() from the main file.
void set_theme(std::string_view theme)
Switches the project's theme.
Manager(std::filesystem::path start_dir=std::filesystem::current_path())
Locates and loads the project that contains start_dir.
static void write_config(const std::filesystem::path &root_dir, const ProjectConfig &config)
Writes config as <root_dir>/.notex/notex.json, creating <root_dir>/.notex/ first if it does not alrea...
bool reset(bool force=false)
Regenerates the main file from the template, after backing up the previous one to <main_file>....
static std::vector< std::string > available_themes()
ProjectConfig & config() noexcept
static Manager init(const std::filesystem::path &target_dir, templates::ProjectType project_type=templates::ProjectType::MULTI, bool force=false)
Creates a new NoTeX project inside target_dir.
const ProjectConfig & config() const noexcept
bool remove_section(int number)
Removes the section numbered number.
@ MULTI
main.tex plus a sections/ directory of subfiles.
Outcome of a Manager::clean() call.
std::size_t total_removed() const noexcept
Persisted metadata for a single NoTeX project, stored as JSON in .notex/notex.json.
std::string notex_version
std::string main_file
Project's entry .tex file.
int schema_version
Version of this on-disk schema.
std::string theme
Set by the theme command.
std::string installation_type
std::string bibliography_file
Set once a bibliography exists.
std::string project_type
"mono" or "multi"; set by init.
templates: encoded skeletons used to scaffold new NoTeX projects.