Tutorial Upgrades for June 3, 2023. Significant changes:
inout/shared.gmd - migration of -shared command tutorial from 1.6,
retiring the old command. New example and a revised discussion on
the mapping between command arguments and the kinds of contiguous
buffers that arise from various sets of arguments.
Other bits are in the works, but not until mid-June. Enjoy!
@David_Tschumperle:
The Technical Reference derives almost (maybe entirely?) from gmic/src/gmic_stdlib.gmic in the gmic repository, no? Am I correct in that the avenue toward addressing @samj 's observations would be edits to that file? But it is not clear to me the best way to implement changes that would be kinder to Windows11. The build environment is there, but I havenât familiarized myself with it (perhaps I should).
I simply note that the examples of the command lines are to be corrected or simply does not work in the HTML or PDF documentation.
There are problems under Linux and Windows.
I do not know how to correct these errors and I started a list of HTML pages where they are indicated.
I think it would be interesting to correct this documentation.
Well, thatâs probably because the example shown include âreservedâ characters used also by the shell you use to run these commands.
But as these characters are different from one shell to another, I canât give as many examples as there are existing shells.
Keep in mind that these special characters have to be âescapedâ when invoking the command from a terminal. Also of course, all commands involving an argument such as image.jpg must replace this filename by a valid image name.
Coping with the local shell is a perennial issue. It processes whatever is typed at the shell prompt before GâMIC even sees the command line string. Tutorial Land has a Custom Cheat which attempts to address this issue. Since shell prepossessing is a source of frustration for many a beginning script writer, I am thinking of moving some form of this cautionary way up front: to Start Here. Since the Technical Reference links to this page, its readers can benefit from such an early warning â so long as they follow the link.
Possibly, before offering such a link, the Technical Reference should have a terse warning of its own. Something to the effect of:
Be advised that the examples in this Reference are subject to shell preprocessing; successfully executing many examples calls for being familiar with your shellâs special characters and escaping them accordingly.
Alternatively, consider writing a small Custom Command to encapsulate the example. This bypasses most shell interaction. The tutorial outlines the basic approach.
Perhaps this is too verbose for the Technical Reference. But something like this could live in the more verbose tutorial guide, and the Reference can link to it.
will work as expected.
These examples are examples of use of the GâMIC language, not examples of shell commands.
Thereâs no point in giving examples of command lines running in a terminal if you donât say which terminal it is (there are dozens of different terminals, each with its own specific features).
For a reference documentation, it is just not possible to give example that are working with all possible terminals. Itâs not a question of âit should be workingâ, or not. It is just not possible to have this.
The examples accompanying The List of Commands illustrate the use of the GâMIC language and are written as they would appear in a custom command. While some examples may work if entered directly at a shell prompt, there is no guarantee. No attempt has been made to escape special characters in these examples, which many shells reserve⊠_
The âStart Hereâ page, which one lands upon by following the Tutorial link, will be so modified to explicitly present a template for a âfinger exerciseâ. This template is drawn directly from what @David_Tschumperle illustrated with custom command foo in Post 129 and the accompanying advice would suggest that a âfinger exerciseâ is the easiest way to bypass most shell peculiarities. When the beginner lights upon a Technical Reference command description, they would be guided in how to turn that example into a finger exercise.
Iâll set about to do this at the next Tutorial upgrade, probably just after the Ides of June.
Ah me. With my suggestion, I have induced @David_Tschumperle to open a can of worms:
this âList of Commandsâ illustrate the use of the GâMIC language and are written as they would appear in a custom command.
Except, with $ gmic preceding most of the examples, there is the decided indication of a command line being in use, and not the interior of a custom command. So much for consistency in aimsâŠ
Suggesting to adjust nine hundred or so commands is just my quaint little way of celebrating the 79th anniversary of the Invasion of Normandy, which is today, and marking one of the largest logistic exercises taken up in modern times. So, patching 900 or so commands? Pfft! Nothing compared to other kerfuffles that have taken place in and around Caen.
I think I shall be experimenting with some Emacs macros tonight, some of which have turned similar format automation tricks for me in times past, including line wraps for A4 paper. And yes, gmic_stdlib.gmic also underlies the -help command entries, as well as the Technical Reference, so a bit of care is in order. Might offer up trial patches along these lines this coming weekend. Cheers!
I guess a solution regarding syntax difference per shell is to write a Python script that would address those limitations when it comes, and have user select shell example choices. I could do a bit of that via Python and regex as now I know how to use Python to automate GâMIC coding. But, I think thatâs just way too much regardless. Maybe later I could help on that, but between GâMIC things and other things I like doing, consider me out on that.
One simple trick for Linux :
If your GâMIC command line does not use the single quote character ', then using command run is a good way to execute commands :
$ gmic run 'sp , repeat 9 +rotate[0] {$>*36},1,0,50%,50% done add div 10'