OmniStacksStaticModules 2.0.0
Loading...
Searching...
No Matches
main.cpp File Reference

Stacks_Tools 单入口:只负责运行时路径发现、CLI 路由与输出。 More...

#include <unistd.h>
#include <cstdio>
#include "json.hpp"
import std;
import InterfaceLog;
import ProjectSync;
import ReminderSync;
import TaskManager;
import WorkflowUI;
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{main.cpp}::Runtime
 一次进程调用共享的根目录、数据库路径和默认 Inbox 工作区。 More...

Namespaces

namespace  anonymous_namespace{main.cpp}

Enumerations

enum class  anonymous_namespace{main.cpp}::ExitCode : int { anonymous_namespace{main.cpp}::ok = 0 , anonymous_namespace{main.cpp}::usage = 1 , anonymous_namespace{main.cpp}::failed = 2 }

Functions

std::expected< std::monostate, interface_log::LogError > anonymous_namespace{main.cpp}::initialize_log (const std::filesystem::path &path)
 初始化 bqlog,并临时把 stdout 指向 stderr。
fs::path anonymous_namespace{main.cpp}::executable_directory (const char *argv0)
 解析 argv[0] 的绝对目录;weakly_canonical 失败时回退到 absolute。
fs::path anonymous_namespace{main.cpp}::find_source_root (fs::path start)
 源码运行时向上查找 CMakeLists.txt,作为项目根目录。
bool anonymous_namespace{main.cpp}::environment_flag (std::string_view name, bool fallback)
 Alfred 布尔变量的宽容解析。
std::optional< std::string > anonymous_namespace{main.cpp}::ensure_runtime_layout (const fs::path &root)
 首次运行补齐 data/log 和三个空 JSON。
Runtime anonymous_namespace{main.cpp}::discover_runtime (const char *argv0)
 发现运行根目录、workflow 目录和默认 Inbox。
void anonymous_namespace{main.cpp}::print_usage ()
 打印完整 CLI 帮助;仅用于终端调试,不进入 Alfred Script Filter 输出。
void anonymous_namespace{main.cpp}::print_task (const TaskManager::TaskRecord &task)
 任务列表行的稳定 TSV 格式,便于 awk/人工调试。
int anonymous_namespace{main.cpp}::run_sync (const Runtime &runtime, const fs::path &path)
 CLI sync:把新工作区交给 ProjectSync,并输出项目/清单统计。
int anonymous_namespace{main.cpp}::run_add (const Runtime &runtime, const std::string &target, const std::string &payload, const std::vector< std::string > &values)
 CLI add:向项目或清单创建任务。
int anonymous_namespace{main.cpp}::run_inbox (const Runtime &runtime, const std::string &payload, const std::vector< std::string > &values)
 CLI inbox:在默认/显式工作区创建收件箱任务。
std::vector< std::string > anonymous_namespace{main.cpp}::arguments (int argc, char *argv[], int start)
 从 argv[start..] 复制额外参数;start 之后的参数所有权仍属于进程。
std::optional< std::string > anonymous_namespace{main.cpp}::option_value (const std::vector< std::string > &values, std::string_view option)
 返回第一个 --option value 的值;缺失返回 nullopt。
bool anonymous_namespace{main.cpp}::has_option (const std::vector< std::string > &values, std::string_view option)
 检查布尔开关参数是否存在,例如 --dry-run、--todo-only。
int anonymous_namespace{main.cpp}::run_boards (const Runtime &runtime, std::string query)
 CLI boards:按显示名/ID 过滤项目与清单。
int anonymous_namespace{main.cpp}::run_tasks (const Runtime &runtime, const std::vector< std::string > &values)
 CLI tasks:把 –board/–query/–todo-only 映射为过滤条件。
int anonymous_namespace{main.cpp}::run_week (const Runtime &runtime, std::optional< std::string > anchor)
 CLI week:返回指定锚点周的未完成截止任务。
int anonymous_namespace{main.cpp}::run_get (const Runtime &runtime, const std::string &id)
 CLI get:输出单个任务的 Stacks 兼容字段。
int anonymous_namespace{main.cpp}::run_edit (const Runtime &runtime, const std::string &id, const std::vector< std::string > &values)
 CLI edit:构造三态 TaskPatch 并写回任务。
template<typename Result>
int anonymous_namespace{main.cpp}::print_task_result (const std::string &command, const Result &result)
 统一打印各种 expected 任务操作结果。
ReminderSync::Provider anonymous_namespace{main.cpp}::parse_provider_or_default (const std::string &value, bool *valid)
 将 provider 文本解析为枚举;invalid 通过输出参数报告,避免抛异常。
int anonymous_namespace{main.cpp}::run_sync_reminder (const Runtime &runtime, const std::string &id, const std::string &provider_text, bool dry_run)
 CLI sync-reminder:读取任务快照并同步到指定外部应用。
int anonymous_namespace{main.cpp}::run_sync_week (const Runtime &runtime, const std::string &provider_text, bool dry_run)
 CLI sync-week:逐个同步本周截止任务。
int anonymous_namespace{main.cpp}::run_ui (const Runtime &runtime, const std::string &query)
 CLI ui:把查询交给 WorkflowUI。
int anonymous_namespace{main.cpp}::run_action (const Runtime &runtime, const std::string &token)
 CLI action:执行 Alfred 选中的 action token。
int main (int argc, char *argv[])

Detailed Description

Stacks_Tools 单入口:只负责运行时路径发现、CLI 路由与输出。

单 main 约束:

  • 只 import 已导出的静态模块,不直接实现任务/路径/提醒业务;
  • 启动时发现源码树或 Alfred workflow 根目录,并补齐 data/log 目录;
  • CLI 参数只做轻量拆分,日期、优先级等规则全部下沉到 TaskManager;
  • 所有命令统一返回 ok=0、usage=1、failed=2,供 Alfred 判断成功/失败音效。

Definition in file main.cpp.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 642 of file main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: