xcommon-sh
Shared shell library for the newer local-archive x* EDirect scripts. It is not a meaningful standalone CLI; it defines common variables and functions such as ParseStdin, GetUIDs, FindArchiveFolder, FindPostingsFolder, FindDataFolder, DisplayError, and date-constraint normalization.
Quick Start
- File:
/home/vimalinx/miniforge3/envs/bio/bin/xcommon.sh - Typical use: sourced by sibling tools such as
xfetch,xfilter, andxinfo - Not a normal command: direct execution provides no useful interface
When To Use This Tool
- Understanding why
xfetch,xfilter, orxinfobehave the way they do - Debugging local archive/postings path discovery based on
EDIRECT_LOCAL_ARCHIVE - Inspecting shared stdin parsing and UID-normalization logic across the
x*helpers - Auditing common error/warning rendering or
EDIRECT_TRACEbehavior
Common Patterns
# Read the shared helper source
sed -n '1,260p' /home/vimalinx/miniforge3/envs/bio/bin/xcommon.sh
# Grep the library for folder-discovery helpers
rg 'FindArchiveFolder|FindPostingsFolder|FindDataFolder' /home/vimalinx/miniforge3/envs/bio/bin/xcommon.sh
# Source it inside a debugging shell if needed
. /home/vimalinx/miniforge3/envs/bio/bin/xcommon.sh
Recommended Workflow
- Treat
xcommon.shas shared implementation, not as an end-user command. - Read it when a sibling
x*wrapper emits path or stdin-source errors that seem opaque. - Focus first on
FindLocalArchiveFolder,GetUIDs,ParseStdin, and the display helpers. - If tracing is needed, set
EDIRECT_TRACE=truebefore running the higher-level wrapper that sources this file.
Guardrails
- Direct execution is effectively meaningless here:
xcommon.sh -handxcommon.sh --versionproduced no useful output in local testing. - Source inspection shows local path discovery ultimately calls
rchive -local <db> <Archive|Postings|Data|Source>. - If
EDIRECT_LOCAL_ARCHIVEcannot be resolved, the shared helper emitsERROR: Must supply path to local data by setting EDIRECT_LOCAL_ARCHIVE environment variableand exits. GetUIDsnormalizes IDs by splitting on non-alphanumeric/underscore/dot characters and sorting/uniquing the final stream.