Skip to content

Commit

Permalink
doc: remove dune:action directive (#10152)
Browse files Browse the repository at this point in the history
* doc: use describe instead of dune:action

Signed-off-by: Etienne Millon <me@emillon.org>

* Remove actions from dunedomain

Signed-off-by: Etienne Millon <me@emillon.org>

---------

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon authored Mar 5, 2024
1 parent e60e4e8 commit f04be44
Show file tree
Hide file tree
Showing 23 changed files with 23 additions and 78 deletions.
35 changes: 1 addition & 34 deletions doc/exts/sphinx_dunedomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,53 +134,24 @@ def add_target_and_index(self, name_cls, sig, signode):
domain.add_field(path, sig)


class ActionDirective(ObjectDescription):
"""
The action directive.
"""

option_spec = {
"param": directives.unchanged_required,
}

def handle_signature(self, sig, signode):
param = self.options.get("param", "...")
text = f"({sig} {param})"
signode += addnodes.desc_name(text=text)
return sig

def add_target_and_index(self, name_cls, sig, signode):
signode["ids"].append(f"action-{sig}")
domain = self.env.get_domain("dune")
domain.add_action(name_cls)


class DuneDomain(Domain):
name = "dune"

directives = {
"stanza": StanzaDirective,
"field": FieldDirective,
"action": ActionDirective,
}
indices = {StanzaIndex, FieldIndex}
initial_data = {"stanzas": [], "fields": []}
object_types = {"action": ObjType("action")}

def get_full_qualified_name(self, node):
return f"stanza.{node.arguments[0]}"

def get_stanzas(self):
return self.data["stanzas"]

def get_actions(self):
return [
(f"action.{name}", name, "action", docname, f"action-{name}", 0)
for name, docname in self.actions.items()
]

def get_objects(self):
return self.get_stanzas() + self.get_actions()
return self.get_stanzas()

def add_stanza(self, signature):
name = f"stanza.{signature}"
Expand All @@ -200,12 +171,8 @@ def add_field(self, path, field):
typ = f"Field in {pretty_path}"
self.data["fields"].append((name, field, typ, self.env.docname, anchor))

def add_action(self, name):
self.actions[name] = self.env.docname

def setup(self):
super().setup()
self.actions = {}
self.env.current_path = []

def find_object(self, typ, name):
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/bash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ bash

.. highlight:: dune

.. dune:action:: bash
:param: <cmd>
.. describe:: (bash <cmd>)

Execute a command using ``/bin/bash``. This is obviously not very portable.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/cat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ cat

.. highlight:: dune

.. dune:action:: cat
:param: <file> ...
.. describe:: (cat <file> ...)

Sequentially print the contents of files to stdout.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/chdir.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ chdir

.. highlight:: dune

.. dune:action:: chdir
:param: <dir> <DSL>
.. describe:: (chdir <dir> <DSL>)

Run an action in a different directory.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/cmp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ cmp

.. highlight:: dune

.. dune:action:: cmp
:param: <file1> <file2>
.. describe:: (cmp <file1> <file2>)

``(cmp <file1> <file2>)`` is similar to ``(run cmp <file1> <file2>)`` but
allows promotion. See :doc:`/concepts/promotion` for more details.
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/concurrent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ concurrent

.. highlight:: dune

.. dune:action:: concurrent
:param: <DSL>...
.. describe:: (concurrent <DSL> ...)

Execute several commands concurrently and collect all resulting errors, if any.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/copy#.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ copy#

.. highlight:: dune

.. dune:action:: copy#
:param: <src> <dst>
.. describe:: (copy# <src> <dst>)

Copy a file and add a line directive at the beginning.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/copy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ copy

.. highlight:: dune

.. dune:action:: copy
:param: <src> <dst>
.. describe:: (copy <src> <dst>)

Copy a file. If these files are OCaml sources, you should follow the
``module_name.xxx.ml`` :ref:`naming convention <merlin-filenames>` to
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/diff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ diff

.. highlight:: dune

.. dune:action:: diff
:param: <file1> <file2>
.. describe:: (diff <file1> <file2>)

``(diff <file1> <file2>)`` is similar to ``(run diff <file1> <file2>)`` but
is better and allows promotion. See :doc:`/concepts/promotion` for more
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/diffq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ diff?

.. highlight:: dune

.. dune:action:: diff?
:param: <file1> <file2>
.. describe:: (diff? <file1> <file2>)

``(diff? <file1> <file2>)`` is similar to ``(diff <file1> <file2>)`` except
that ``<file2>`` should be produced by a part of the same action rather than
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/dynamic-run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ dynamic-run

.. highlight:: dune

.. dune:action:: dynamic-run
:param: <prog> <args>
.. describe:: (dynamic-run <prog> <args>)

Execute a program that was linked against the ``dune-action-plugin`` library.
``<prog>`` is resolved in the same way as in :doc:`run`.
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/echo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ echo

.. highlight:: dune

.. dune:action:: echo
:param: <string>
.. describe:: (echo <string>)

Output a string on ``stdout``.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/ignore-outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ ignore-<outputs>

.. highlight:: dune

.. dune:action:: ignore-<outputs>
:param: <DSL>
.. describe:: (ignore-<outputs> <DSL>)

Ignore the output, where ``<outputs>`` is one of: ``stdout``, ``stderr``, or
``outputs``.
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/no-infer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ no-infer

.. highlight:: dune

.. dune:action:: no-infer
:param: <DSL>
.. describe:: (no-infer <DSL>)

Perform an action without inference of dependencies and targets. This is
useful if you are generating dependencies in a way that Dune doesn't know
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/pipe-outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ pipe-<outputs>

.. highlight:: dune

.. dune:action:: pipe-<outputs>
:param: <DSL> <DSL> <DSL>...
.. describe:: (pipe-<outputs> <DSL> <DSL> <DSL>...)

.. versionadded:: 2.7

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/progn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ progn

.. highlight:: dune

.. dune:action:: progn
:param: <DSL>...
.. describe:: (progn <DSL> ...)

Execute several commands in sequence.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ run

.. highlight:: dune

.. dune:action:: run
:param: <prog> <args>
.. describe:: (run <prog> <args>)

Execute a program. ``<prog>`` is resolved locally if it is available in the
current workspace, otherwise it is resolved using the ``PATH``.
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/setenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ setenv

.. highlight:: dune

.. dune:action:: setenv
:param: <var> <value> <DSL>
.. describe:: (setenv <var> <value> <DSL>)

Run an action with an environment variable set.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ system

.. highlight:: dune

.. dune:action:: system
:param: <cmd>
.. describe:: (system <cmd>)

Execute a command using the system shell: ``sh`` on Unix and ``cmd`` on Windows.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/with-accepted-exit-codes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ with-accepted-exit-codes

.. highlight:: dune

.. dune:action:: with-accepted-exit-codes
:param: <pred> <DSL>
.. describe:: (with-accepted-exit-codes <pred> <DSL>)

.. versionadded:: 2.0

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/with-outputs-to.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ with-<outputs>-to

.. highlight:: dune

.. dune:action:: with-<outputs>-to
:param: <file> <DSL>
.. describe:: (with-<outputs>-to <file> <DSL>)

Redirect the output to a file, where ``<outputs>`` is one of: ``stdout``,
``stderr`` or ``outputs`` (for both ``stdout`` and ``stderr``).
Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/with-stdin-from.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ with-stdin-from

.. highlight:: dune

.. dune:action:: with-stdin-from
:param: <file> <DSL>
.. describe:: (with-stdin-from <file> <DSL>)

Redirect the input from a file.

Expand Down
3 changes: 1 addition & 2 deletions doc/reference/actions/write-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ write-file

.. highlight:: dune

.. dune:action:: write-file
:param: <file> <string>
.. describe:: (write-file <file> <string>)

Writes ``<string>`` to ``<file>``.

Expand Down

0 comments on commit f04be44

Please sign in to comment.