docs: document application command-chain#5599
Conversation
2e96ff5 to
5ef96ea
Compare
|
This looks good to me. The protocol explanation is a gem. |
|
We will need to land #5603 first to fix the docs. |
| steps or anything else that makes sense in a given situation. Command chain | ||
| elements are usually reusable across applications. Command chain elements are |
There was a problem hiding this comment.
Command chain elements are usually reusable across applications.
As in different app entries in the same snap or different snaps? The "usually" in this sentence and the next sentence are throwing me off. Is this referring to scripts that get re-used like desktop-launch or alsa-launch?
There was a problem hiding this comment.
I tried to convey that you can use the same command chain element across many snaps and many apps as they are kind of "middleware". Let me know how to re-phrase that in the text.
758e827 to
30d78fe
Compare
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
30d78fe to
6af3172
Compare
| Command chain is a mechanism for running small pieces of code before the main | ||
| application executable. The chain uses ``exec`` to transition the process from | ||
| the current element of the chain to the next. The last element of the chain is | ||
| always the application executable. |
There was a problem hiding this comment.
| Command chain is a mechanism for running small pieces of code before the main | |
| application executable. The chain uses ``exec`` to transition the process from | |
| the current element of the chain to the next. The last element of the chain is | |
| always the application executable. | |
| A command chain is a mechanism for running small pieces of code before the main | |
| application executable. The chain uses ``exec`` to transition the process from | |
| the current element of the chain to the next. The last element of the chain is | |
| always the application executable. |
It's important to use articles to distinguish between a concept/category, and actual objects in the software that users interact with.
| application executable. The chain uses ``exec`` to transition the process from | ||
| the current element of the chain to the next. The last element of the chain is |
There was a problem hiding this comment.
What do you think of:
| application executable. The chain uses ``exec`` to transition the process from | |
| the current element of the chain to the next. The last element of the chain is | |
| application executable. The chain uses the ``exec`` command to shift from | |
| the current command to the next. The last element of the chain is |
| Command chain may be used to modify process environment, perform initialization | ||
| steps or anything else that makes sense in a given situation. Command chain | ||
| elements are usually reusable across applications. Command chain elements are | ||
| also usually stackable, so an application can use several tailored command | ||
| chain elements to perform unrelated functions. |
There was a problem hiding this comment.
I tried to clear it up a little:
| Command chain may be used to modify process environment, perform initialization | |
| steps or anything else that makes sense in a given situation. Command chain | |
| elements are usually reusable across applications. Command chain elements are | |
| also usually stackable, so an application can use several tailored command | |
| chain elements to perform unrelated functions. | |
| A command chains is used to modify the process environment, perform initialization | |
| steps, or any other situation where an ordered sequence of commands is needed. | |
| Chained commands are usually reusable between apps in a part. The commands are | |
| also usually stackable, so an application can use several tailored commands to | |
| perform unrelated functions. |
I said "apps in a part", but that might be too narrow for what @zyga is saying.
I'm not sure what we mean by "usually stackable". When are they not stackable? Isn't that an inherent quality of the concept?
There was a problem hiding this comment.
The are stackable in the sense that you can take a command chain that, say, handles fontconfig cache, then another one that prepares your XDG configuration, then another one to generate locale data based on what the user is doing and each of those programs is entirely unrelated to each other, and can be used across apps and snaps.
There was a problem hiding this comment.
I don't think I follow the metaphor. Is it different than being modular?
| - bin/foo | ||
| - bin/bar |
There was a problem hiding this comment.
| - bin/foo | |
| - bin/bar | |
| - bin/foo | |
| - bin/bar |
Not every system in our tooling plays nice with same-indentation collections.
| ------- | ||
|
|
||
| Both ``bin/foo`` and ``bin/bar`` can be written as simple shell scripts or | ||
| comprehensive, compiled programs. A shell version might look like this. Notice |
There was a problem hiding this comment.
| comprehensive, compiled programs. A shell version might look like this. Notice | |
| compiled programs. A shell version might look like this. Notice |
| ------- | ||
|
|
||
| Both ``bin/foo`` and ``bin/bar`` can be written as simple shell scripts or | ||
| comprehensive, compiled programs. A shell version might look like this. Notice |
There was a problem hiding this comment.
I think I would put the "Notice..." sentence after the code block, so the reader has the chance to look at the code and think about it before we isolate part of it.
| calling ``exec`` (without forking the process). Here both ``bin/foo`` and | ||
| ``bin/bar`` would follow the same protocol, ultimately executing ``bin/hello``. | ||
| The next element of the chain is passed through the process argument vector. | ||
|
|
||
| In the example above, ``snap-exec`` would call ``exec bin/foo bin/bar | ||
| bin/hello`` with ``bin/foo`` as the program path and program name and ``bin/bar | ||
| bin/hello`` as arguments. This protocol continues until the application entry | ||
| point is reached. |
There was a problem hiding this comment.
Food for thought: this could also be visualised as a series of nodes in ASCII. It would reinforce the meaning.
| -------- | ||
|
|
||
| Every element of the chain is responsible for executing the next chain by | ||
| calling ``exec`` (without forking the process). Here both ``bin/foo`` and |
There was a problem hiding this comment.
| calling ``exec`` (without forking the process). Here both ``bin/foo`` and | |
| calling ``exec`` (without forking the process). Continuing with the previous example, both ``bin/foo`` and |
make lint?make test?^ No, because those do not seem to work on my Fedora 42 system.