Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output for config file use is wrong #37

Closed
maxrake opened this issue Aug 23, 2022 · 0 comments · Fixed by #38
Closed

Output for config file use is wrong #37

maxrake opened this issue Aug 23, 2022 · 0 comments · Fixed by #38

Comments

@maxrake
Copy link
Contributor

maxrake commented Aug 23, 2022

When using a config file, the output will be wrong...pointing to an incorrect config file. The exception is for config files that also happen to be the last one specified in the self.configs list.

To reproduce this issue, create a config file at one of either the first two "known" locations:

self.configs = [
    # Create a config here
    ".rich-codex.yml",
    # ...or here...
    ".github/rich-codex.yml",
    # ...but not here
    "docs/img/rich-codex.yml"
]

For example, this config file, at .rich-codex.yml:

---
outputs:
  - command: "python -m pip list"
    fake_command: "pip list"
    title: Installed Packages
    img_paths:
      - docs/img/pip_list.svg

results in output like this:

❯ rich-codex -v --skip-git-checks
INFO     rich-codex ⚡️📖⚡️ version 1.2.4
DEBUG    Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=/Users/maxrake/dev/delme/rich-codex, universal_newlines=False, shell=None,
         istream=None)
DEBUG    Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=/Users/maxrake/dev/delme/rich-codex, universal_newlines=False, shell=None, istream=None)
DEBUG    Popen(['git', 'diff', '--abbrev=40', '--full-index', '-M', '--raw', '-z', '--no-color'], cwd=/Users/maxrake/dev/delme/rich-codex, universal_newlines=False,
         shell=None, istream=None)
DEBUG    Popen(['git', 'cat-file', '--batch-check'], cwd=/Users/maxrake/dev/delme/rich-codex, universal_newlines=False, shell=None, istream=<valid stream>)
DEBUG    Popen(['git', 'status', '--porcelain', '--untracked-files'], cwd=/Users/maxrake/dev/delme/rich-codex, universal_newlines=False, shell=None, istream=None)
DEBUG    Git status check: Found uncommitted changes: ['README.md', 'docs/config/colours.md', 'docs/config/command_setup.md', 'docs/config/ignoring_changes.md',
         'docs/config/tweaks.md', 'docs/index.md', 'docs/inputs/markdown.md', 'docs/troubleshooting.md', 'docs/usage/cli.md', 'src/rich_codex/codex_search.py',
         '.rich-codex.yml', 'docs/img/main_header.svg', 'docs/img/pip_list.svg'] (skip_git_checks: True)
DEBUG    Trimming terminal output down to a minimum of 80
DEBUG    Appending contents of .gitignore to 'SEARCH_EXCLUDE'
DEBUG    Found config '.rich-codex.yml'
DEBUG    Couldn't find '.github/rich-codex.yml'
DEBUG    Couldn't find 'docs/img/rich-codex.yml'
INFO     Found 1 config file
DEBUG    Found valid output in 'docs/img/rich-codex.yml': {'command': 'python -m pip list', 'fake_command': 'pip list', 'title': 'Installed Packages', 'img_paths':
         ['docs/img/pip_list.svg']}
INFO     Searching 21 files
---TRIMMED---
DEBUG    Collapsing 1 image requests to 1 deduplicated
╭────────────────────┬─────────────────────────╮
│ Commands to run:   │ Source                  │
├────────────────────┼─────────────────────────┤
│ python -m pip list │ docs/img/rich-codex.yml │
╰────────────────────┴─────────────────────────╯

Notice that the correct config (.rich-codex.yml) was found and identified, but then the incorrect config (docs/img/rich-codex.yml) was referenced after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant