tldr-pages / tldr-pages/tldr-python-client

Allow `TLDR_PAGES_SOURCE_LOCATION` to contain multiple locations

Open
#188 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
749
Forks
117
PR merge metrics
No merged PRs in 30d

Description

In my work environment, I'm maintaining a fork of tldr-pages to add pages that are private and not ever intended to be merged upstream. In order to not have to maintain a fork, I'd be interested in maintaining a sparse replica that only contains the pages are company maintains.

I was thinking that the variable could be set as follows:

TLDR_PAGES_SOURCE_LOCATION="https://raw.githubusercontent.com/tldr-pages/tldr/master/pages;https://raw.githubusercontent.com/big-corp/tldr/master/pages"

or

TLDR_PAGES_SOURCE_LOCATION="https://raw.githubusercontent.com/tldr-pages/tldr/master/pages;${HOME}/.tldr/pages

In the above ${HOME}/.tldr is a clone of github.com/big-corp/tldr.

For duplicates or conflicts, I can see a few ways of managing:

  • First one found wins. Probably the best for performance.
  • Last one found wins. Requires a lookup in every page repo.
  • Error on duplicate. Requires a lookup in every page repo and could be views as poor user experience.

Curious what people think. I'd be happy to implement this if the maintainers feel like this could be a workable feature.

Here's my tldr shim I use:

#!/usr/bin/env bash

set -e
set -o pipefail

if [[ ! -d ~/.tldr ]]; then
  echo "Fetching tldr-pages from GitHub..."
  # Use public repo until I have something to hide ;-)
  # Would need to display a useful message if keys aren't loaded
  git clone https://github.com/scottmuc/tldr.git ~/.tldr 2> /dev/null
fi

if [[ "$1" = "--update_cache" || "$1" = "-u" ]]; then
  echo "Updating tldr-pages from GitHub..."
  ( cd ~/.tldr && git pull )
else
  # Disable the cache so standard tldr-pages repo and zip aren't used
  env \
    TLDR_CACHE_ENABLED=0 \
    TLDR_PAGES_SOURCE_LOCATION="file://${HOME}/.tldr/pages" \
    "${HOMEBREW_PREFIX}/bin/tldr" "$@"
fi

and here's it in action:

~ ? tldr muc

  muc

  Scott Muc's cheat sheet.
  More information: https://github.com/scottmuc/tldr/.

  - Initalize 1Password:
    initalize-1password

The reason why this feature in the client would be useful is to remove the need to maintain a fork of the pages as well as providing a home for the additional pages that's not surrounded my upstream maintained files.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating where TLDR_PAGES_SOURCE_LOCATION is parsed and where page sources are searched; the issue names no files or tests. First settle duplicate and conflict precedence with maintainers, then verify that multiple URL or local locations are supported as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.