-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
developmentStandard developmentStandard development
Description
Specification
When executing the polykey vaults log command, the CLI should automatically detect and utilize the system's PAGER (e.g., less, more) if it exists. If no PAGER is available, the command should default to streaming the output directly to the terminal. This behavior should be consistent across different operating systems, including Windows and MacOS. The implementation should be inspired by git log, which similarly uses a PAGER for its output.
Additional context
- Prior Work: The
git logcommand is a well-known example of this behavior, and its implementation can serve as a reference. It defaults tolessas the PAGER on Unix-like systems and uses a pager-like mechanism on Windows. - Cross-Platform Considerations:
- On Unix-like systems (e.g., MacOS, Linux), the PAGER is typically set in the environment variables (e.g.,
$PAGER). - On Windows, common pagers like
moreare available, and the behavior should mimic Unix systems as closely as possible. - If no PAGER is detected, the output should stream directly to the terminal, ensuring the command remains functional even in environments without a PAGER.
- On Unix-like systems (e.g., MacOS, Linux), the PAGER is typically set in the environment variables (e.g.,
- https://unix.stackexchange.com/a/213369/56970
Tasks
- Pager Detection: Implement logic to detect the presence of a PAGER in the system environment variables. On Unix-like systems, check for
$PAGER. On Windows, check for the availability ofmoreor other pagers. - Fallback Mechanism: If no PAGER is detected, ensure the command streams the output directly to the terminal.
- Cross-Platform Integration: Ensure the implementation works consistently across Unix-like systems and Windows, handling the differences in how pagers are managed on each platform.
- Testing: Implement unit tests and integration tests to verify the behavior in different environments (with/without PAGER, on Windows/MacOS/Linux).
- Documentation: Update the CLI documentation to reflect this behavior, including examples of how to set a custom PAGER if desired.
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard development