ocaml / ocaml/dune

Add iteration to user actions

Open
#2,945 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Hi,
AFAIK, it's not currently possible to iterate (à la for f in *.md, in bash for instance), in a user action, over a set of file names matched by a glob. Considering how it's frequent to resort to this in scripts, I would argue it's useful. Of course, a counter-argument is to avoid user actions to become a full-featured shell...
Use case: iterate over files to perform a given action, e.g. running expect (ocaml-mdx) tests; tentative syntax:

(alias
  (name regression)
  (deps 
    (package mypackage) 
    (:mds (glob_files *.md)) 
  )
  (action (foreach %{f} %{mds}; <-- iterate one by one over files matching the glob above
       (progn     
           (run ocaml-mdx test %{f})
           (diff? %{f} %{f}.corrected)))))

Contributor guide

Open the contributing guide

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

The issue names no repository files or tests; start by tracing the user-action handling and the proposed glob_files/foreach syntax. Clarify iteration semantics and use the ocaml-mdx example as the acceptance case, with tests covering matched files and the resulting per-file actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
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.