arthurdick/perennial-task
Composer 安装命令:
composer create-project arthurdick/perennial-task
包简介
A simple, command-line utility to help you cultivate recurring responsibilities.
README 文档
README
Like the wood lily that graces the prairies each summer, some tasks are perennial. They return, season after season, requiring steady attention. Perennial Task is a simple, command-line utility built to help you cultivate these responsibilities, ensuring nothing is ever overlooked.
Features
- Flexible Task Scheduling: Perennial Task uses a simple but powerful system. A task is either Normal (a simple, one-off to-do) or Scheduled (a task with a due date).
- Powerful Rescheduling: A scheduled task can be configured to automatically reschedule itself after completion. You have full control over the new due date, calculating it from either the previous due date (for fixed schedules like paying rent) or the completion date (for flexible timelines like watering the houseplants). Intervals can be set in days, weeks, months, or years.
- Task Prioritization: Assign a numerical priority to your tasks. The report view will sort tasks first by their status (overdue, due today, upcoming) and then by their priority, ensuring the most important items always appear first.
- Completion History: Every completed task retains a full history of when it was completed, allowing you to track consistency and habits over time.
- Interactive and Non-Interactive Modes: Create and edit tasks through a user-friendly interactive menu or automate your workflow with powerful command-line flags.
- Intelligent Filtering: The task selection menu is filterable, allowing you to view all tasks, only active ones, or just the reportable (due or upcoming) ones.
- Command-Line Driven: Designed for efficient use within a terminal environment.
Installation and Usage
Perennial Task can be used in three different ways, depending on your needs.
Method 1: PHAR Release (Recommended for most users)
This method uses a single, executable .phar file that contains the entire application. It is the easiest way to get started.
- Download the
prn.pharfile from the latest release on GitHub. - Make it executable:
chmod +x prn.phar - (Optional) Move it into your PATH to make it accessible from anywhere:
sudo mv prn.phar /usr/local/bin/prn - Run it:
# If you moved it into your PATH prn help # If you did not ./prn.phar help
Method 2: Composer (Recommended for PHP developers)
If you are a PHP developer, you can install Perennial Task globally using Composer.
- Install the Package:
composer global require arthurdick/perennial-task - Update Your PATH: Ensure Composer's global bin directory is in your system's
PATH. Add the following line to your~/.bashrcor~/.zshrc:export PATH="$PATH:$(composer global config bin-dir --absolute -q)" - Apply the Changes: Restart your terminal or run
source ~/.bashrc.
Method 3: Manual Installation from Source (Recommended for contributors)
This method is for developers who want to work on the source code.
- Platform & Dependencies: This utility is designed for Linux environments. Ensure you have PHP version 7.4 or higher installed, with the
SimpleXMLandDOMextensions enabled. - Clone the repository and install dependencies:
git clone https://github.com/arthurdick/perennial-task.git cd perennial-task composer install - Run the application using the
prnexecutable in the project root:./prn help
Enabling Bash Completions
To make using prn even faster, you can enable tab completions, which will suggest commands, options, and task file paths automatically.
-
Locate the
prn-completions.bashfile in the root of the project directory. -
Create a symbolic link to it from your system's bash completion directory. This command will vary based on how you installed the application.
- For Composer Installations:
COMPLETIONS_PATH=$(composer global config home -q)/vendor/arthurdick/perennial-task/prn-completions.bash sudo ln -s "$COMPLETIONS_PATH" /etc/bash_completion.d/prn
- For Manual/Source Installations:
# Replace /path/to/perennial-task with the actual path to the cloned repository sudo ln -s /path/to/perennial-task/prn-completions.bash /etc/bash_completion.d/prn
- For Composer Installations:
-
Restart your terminal session or source your
.bashrcfile (source ~/.bashrc) to apply the changes.
Now, you can type prn edi and press Tab, and it should autocomplete to prn edit.
Usage
Once installed, you can use the prn command from any directory.
General Syntax: prn [command] [options] [argument]
Commands
prn create
- Interactively prompts you to create a new Normal or Scheduled task. Can also be used non-interactively with flags.
prn edit <task_file>
- Interactively or non-interactively edit an existing task.
prn complete <task_file>
- Mark a task as complete. If the task is scheduled to repeat, its next due date will be calculated and set automatically.
prn describe <task_file>
- Shows a detailed description, status, and completion summary of any single task.
prn history <task_file>
- Shows the full, detailed completion history for a single task.
prn purge [task_file]
- Remove the history from a specified task, or all tasks.
prn report [date]
- Generates a report of all due, overdue, and upcoming tasks. Optionally run for a specific
[date].
prn help [command]
- Displays a list of available commands or detailed help for a specific command.
prn version
- Displays the application's version number.
Non-Interactive Switches
You can use the following flags to bypass the interactive menus and manage tasks in scripts.
create
--name <name>: The name of the task. (Required for non-interactive use)--due <date>: The date the task is due. AcceptsYYYY-MM-DDor flexible strings like "tomorrow" or "+2 weeks".--priority <int>: Set the task's priority (e.g., -2, 0, 10). Defaults to 0.--preview <days>: The number of days in advance to show the task in reports.--reschedule-interval <interval>: The interval to reschedule the task (e.g., '7 days', '1 month').--reschedule-from <basis>: The basis for rescheduling ('due_date' or 'completion_date').
Example:
prn create --name "Pay monthly internet bill" --due "next friday" --priority 10 --reschedule-interval "1 month" --reschedule-from due_date
edit
--set-name <name>: Set a new name for the task.--rename-file: Rename the task file to match the new name (can only be used with--set-name).--set-due <date>: Set a new due date for the task. AcceptsYYYY-MM-DDor flexible strings like "tomorrow".--remove-due: Remove the due date and all scheduling settings from a task.--set-priority <int>: Set a new priority for the task.--set-preview <days>: Set the number of preview days.--remove-preview: Remove the preview setting from the task.--set-reschedule-interval <interval>: Set the reschedule interval.--set-reschedule-from <basis>: Set the reschedule basis ('due_date' or 'completion_date').--remove-reschedule: Remove all reschedule settings from the task.
Example:
prn edit tasks/my_task.xml --set-due "+3 days" --set-priority 5
complete
--date <date>: The date the task was completed. AcceptsYYYY-MM-DDor flexible strings like "yesterday" (defaults to today).
Example:
prn complete tasks/water_plants.xml --date "yesterday"
purge
--force: Skip the confirmation prompt when purging all tasks.
Example:
prn purge --force
Exit Codes
The application uses the following exit codes to indicate success or the type of error encountered:
- 0: Success.
- 1: A general or unknown error occurred.
- 10: Invalid command-line argument, option, or value.
- 20: A file system error occurred (e.g., file not found, permission denied).
- 30: An invalid file format or configuration error was found.
- 40: A prerequisite check failed (e.g., a required PHP extension is missing).
Backward Compatibility & Migration
This version of Perennial Task uses a new, more flexible format for scheduling. However, it is fully backward compatible with tasks created by older versions.
When you complete or edit a task that uses a legacy format, it will be automatically and silently migrated to the new system. Your data is safe, and your tasks will continue to work as expected.
Configuration
Perennial Task stores its configuration in a file named config.ini, which is automatically created on first run. It allows you to customize paths for your tasks, logs, and other settings. The file is located in $XDG_CONFIG_HOME/perennial-task/ (defaulting to ~/.config/perennial-task/).
You can customize the following settings:
tasks_dir: The directory where your task files are stored.completions_log: The file where task completions are logged.xsd_path: The path to the task schema file.tasks_per_page: The number of tasks to display per page in the interactive selector.timezone: The timezone to use for date calculations.save_history: Whether to save the completion history of tasks. Set tofalseto disable history.
Development and Testing
This project includes a comprehensive test suite built with PHPUnit.
Prerequisites
- Composer: Install from getcomposer.org.
Installing Dependencies
- Clone the repository.
- Navigate to the project's root directory.
- Run
composer installto download development dependencies.
Running the Test Suite
From the project's root directory, run:
composer test
Code Style
This project uses php-cs-fixer. To automatically format your code, run:
composer fix
arthurdick/perennial-task 适用场景与选型建议
arthurdick/perennial-task 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 18, 最近一次更新时间为 2025 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「terminal」 「productivity」 「task-manager」 「task-management」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arthurdick/perennial-task 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arthurdick/perennial-task 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arthurdick/perennial-task 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A fork of runcmf/runtracy
PHP Terminal emulator controller utilizing ANSI escape sequence coding.
Reverts the drop down save buttons in the backend to 3 single buttons
Render small SVG icons to monochrome ANSI for terminal UIs (Laravel/Prompts, Symfony Console, plain CLI).
2020 PHP: A showcase and classroom for the cutting edge features of PHP 8
use laravel eloquent, view, pagination anywhere
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-11
