Command to generate the frontmatter?

Open
#149 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
r, rust

Research direction

Start by reviewing the existing ir run workflow and the frontmatter documentation linked from the issue; no implementation files or tests are named. Define how an ir add-template command should create the shown template, including package and R-version handling, and how ir run should report missing frontmatter; the feature is done when both workflows are specified and tested.

Written by the indexing model from the issue text.

Description

I might be missing something about the usual workflow when using ir (tbh, I have just quickly tried it), but shouldn't there be a command to automatically generate the frontmatter? I don't think uv has this but they have some kind of automation with uv add --script example.py 'requests<3' 'rich'.

I don't want to type the entire frontmatter or to copy it from the docs every time. It would be nice to have ir add-template script.R (probably with a better command name) that would automatically add this:

#!/usr/bin/env -S ir run
#| packages:
#|   - <to fill with packages loaded in the script and their used versions>
#| r-version: ">= <my current R version>"
#| isolated: true

I can then choose to tweak this frontmatter or not. That way, I can take any existing standalone script and instantly add the info used by ir.

I can also imagine ir run giving a message No frontmatter found in <script.R>. Use ir add-template to add one.

Dominant language
Rust
Stars
65
Forks
2
PR merge metrics
No merged PRs in 30d

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.

More from r-lib/ir

All issues in r-lib/ir

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.