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

Runme doesn't execute commands in the current directory #740

Open
paolino opened this issue Feb 12, 2025 · 1 comment
Open

Runme doesn't execute commands in the current directory #740

paolino opened this issue Feb 12, 2025 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@paolino
Copy link

paolino commented Feb 12, 2025

I cannot execute the snippets of a markdown file, which is sitting in a different directory, in the current working directory.

paolino in 🌐 nixos in /tmp/runme-i2e via ❄️   impure (shell) 
❯ tree
.
β”œβ”€β”€ defdir
β”‚   └── test.md
└── rundir

3 directories, 1 file

paolino in 🌐 nixos in /tmp/runme-i2e via ❄️   impure (shell) 
❯ cat defdir/test.md 
> ```bash {"name" : "test"}
> pwd
> ```

paolino in 🌐 nixos in /tmp/runme-i2e via ❄️   impure (shell) 
❯ cd rundir/

paolino in 🌐 nixos in /tmp/runme-i2e/rundir via ❄️   impure (shell) 
❯ runme --filename ../defdir/test.md --chdir $(pwd) run test
/tmp/runme-i2e/defdir

I don't think I should need --chdir ... for this behavior, but it doesn't work. What should I do ? Is it possible ?

@sourishkrout
Copy link
Contributor

sourishkrout commented Feb 18, 2025

Hi @paolino. Thanks for reporting this issue. Please note that runme treats your repo as a "project" versus individual files.

The current working directory is anchored based on the file's location. This allows Runme to be true to the directory hierarchy across client modalities (CLI, notebook, CI/CD).

If you want to modify a markdown file/document's current working directory, that's possible via the document-global directive or on at the individual block/cell. E.g. if you'd kept all markdowns in a ./docs directory but wanted to execute it in the root of the repo, you'd add the following frontmatter to the file.

---
cwd: ..
---

[rest of markdown]

So in a nutshell, the working directory where the CLI runme run ran from is irrelevant. This is intentional to make commands like runme run test, runme run buid, etc work anywhere.

Please let me know if you have more questions!

@sourishkrout sourishkrout added the documentation Improvements or additions to documentation label Feb 18, 2025
@sourishkrout sourishkrout self-assigned this Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants