discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Feature request: man() and echo(,color="blue")

AD
Ari Diacou
Tue, Mar 14, 2017 6:21 PM

It would be nice to have a man command in the console. I'm thinking of a
command like man() which you call like: man(circle), and it outputs the
text from the wikibook manual (skipping code blocks and images, but
respecting returns).

Another feature could be, if you put in a user-defined function, it would
output somehting like comments between the closing peren of the function
and the opening of the brace. For functions, it would grab the comments
between the closing paren and the equals sign.

E.g.

module foo(my_str="hello, world!",n=1)
//creates an output of "hello, world!" by default
//otherwise repeats the string my_msg, n times
{
for(i=[0:n-1])
echo(my_str);
}
function bar(x)/squares the input/=x*x;

man(foo); would output:

MAN:
syntax: foo(my_str="hello, world!",n=1)

user-defined module native to Untitled.scad in D:\My Documents\3D Stuff

creates an output of "hello, world!" by default
otherwise repeats the string my_msg, n times

man(bar); would output:

MAN:
syntax: bar(x)

user-defined module native to Untitled.scad in D:\My Documents\3D Stuff

squares the input

Which brings me to another idea. echo() should take color inputs.

man() seems like an easy text searching function.

PS - If there is no comment in the designated spot, there should be shaming
comment, like "The author of this function is a jerk, and did not write an
explanatory comment. If the author happens to be you, put a comment in
between the closing paren and the equals sign. E.g. function
bar(x)/squares the input/=x*x;" But I think shaming coders into writing
comments is a noble use of software.

--Ari M Diacou, College Park, MD USA

It would be nice to have a man command in the console. I'm thinking of a command like man() which you call like: man(circle), and it outputs the text from the wikibook manual (skipping code blocks and images, but respecting returns). Another feature could be, if you put in a user-defined function, it would output somehting like comments between the closing peren of the function and the opening of the brace. For functions, it would grab the comments between the closing paren and the equals sign. E.g. module foo(my_str="hello, world!",n=1) //creates an output of "hello, world!" by default //otherwise repeats the string my_msg, n times { for(i=[0:n-1]) echo(my_str); } function bar(x)/*squares the input*/=x*x; man(foo); would output: MAN: syntax: foo(my_str="hello, world!",n=1) user-defined module native to Untitled.scad in D:\My Documents\3D Stuff creates an output of "hello, world!" by default otherwise repeats the string my_msg, n times man(bar); would output: MAN: syntax: bar(x) user-defined module native to Untitled.scad in D:\My Documents\3D Stuff squares the input Which brings me to another idea. echo() should take color inputs. man() seems like an easy text searching function. PS - If there is no comment in the designated spot, there should be shaming comment, like "The author of this function is a jerk, and did not write an explanatory comment. If the author happens to be you, put a comment in between the closing paren and the equals sign. E.g. function bar(x)/*squares the input*/=x*x;" But I think shaming coders into writing comments is a noble use of software. --Ari M Diacou, College Park, MD USA
M
MichaelAtOz
Wed, Mar 15, 2017 12:20 AM

drxenocide wrote

Which brings me to another idea. echo() should take color inputs.

man() seems like an easy text searching function.

Personally not a fan...

PS - If there is no comment in the designated spot, there should be
shaming
comment, like "The author of this function is a jerk, and did not write an
explanatory comment. If the author happens to be you, put a comment in
between the closing paren and the equals sign. E.g. function
bar(x)/squares the input/=x*x;" But I think shaming coders into writing
comments is a noble use of software.

--Ari M Diacou, College Park, MD USA

...but you can write it yourself,  OpenSCAD is open source
https://github.com/openscad/openscad/  .


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Feature-request-man-and-echo-color-blue-tp20887p20899.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

drxenocide wrote > Which brings me to another idea. echo() should take color inputs. See the HTML <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Echo_Statements> section. > man() seems like an easy text searching function. Personally not a fan... > PS - If there is no comment in the designated spot, there should be > shaming > comment, like "The author of this function is a jerk, and did not write an > explanatory comment. If the author happens to be you, put a comment in > between the closing paren and the equals sign. E.g. function > bar(x)/*squares the input*/=x*x;" But I think shaming coders into writing > comments is a noble use of software. > > --Ari M Diacou, College Park, MD USA ...but you can write it yourself, OpenSCAD is open source <https://github.com/openscad/openscad/> . ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Feature-request-man-and-echo-color-blue-tp20887p20899.html Sent from the OpenSCAD mailing list archive at Nabble.com.