Skip to content

Commit

Permalink
added extra blurb to all stl_cmds for better man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jallwine committed Dec 18, 2017
1 parent f6f132d commit bd98f62
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $(DOCS_DIR):

docs: $(DOCS_DIR) $(CMDS)
for cmd in $(CMDS); do \
help2man $$cmd --no-discard-stderr --version-string="v$(VERSION)" --no-info > $(DOCS_DIR)/$$(basename $$cmd).1; \
help2man $$cmd --name="$$($$cmd --help 2>&1 | head --lines=1)" --no-discard-stderr --version-string="v$(VERSION)" --no-info > $(DOCS_DIR)/$$(basename $$cmd).1; \
done

installDocs: docs
Expand Down
1 change: 1 addition & 0 deletions src/stl_bbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_bbox prints bounding box information about an STL file.\n\n");
fprintf(stderr, "usage: stl_bbox <input file>\n");
fprintf(stderr, " Prints bounding box information for the given binary STL file.\n");
}
Expand Down
1 change: 1 addition & 0 deletions src/stl_boolean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#include "csgjs/util.h"

void print_usage() {
fprintf(stderr, "stl_boolean performs CSG operations on two STL files.\n\n");
fprintf(stderr, "usage: stl_boolean -a <stl file A> -b <stl file B> [ -i ] [ -u ] [ -d ] <output file>\n");
fprintf(stderr, " Performs a mesh CSG boolean operation on STL files A and B using BSP trees.\n"
" -i - performs the intersection of A and B\n"
Expand Down
13 changes: 4 additions & 9 deletions src/stl_borders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "usage: stl_convex [ -v ] [ <input file> ]\n");
fprintf(stderr, " Prints whether the input file is a convex polyhedron. If no input file is specified, data is read from stdin. If -v is specified, prints out the Euler characteristic in addition to whether the mesh is convex.\n");
fprintf(stderr, "The Euler characteristic of a polyhedral surface is defined as V - E + F, where V is the number of vertices, E is the number of edges, and F is the number of faces. All convex polyhedra will have an Euler characteristic of 2.\n");
fprintf(stderr, "stl_borders prints how many border edges there are in a given STL file.\n\n");
fprintf(stderr, "usage: stl_borders [ <input file> ]\n");
fprintf(stderr, " Prints how many border edges there are. For a watertight, manifold model, it will be 0.\n");
}

struct VertexKey {
Expand Down Expand Up @@ -119,13 +119,8 @@ int main(int argc, char** argv) {
int errflg = 0;
int c;

int verbose = 0;

while((c = getopt(argc, argv, "v")) != -1) {
while((c = getopt(argc, argv, "")) != -1) {
switch(c) {
case 'v':
verbose = 1;
break;
case '?':
fprintf(stderr, "Unrecognized option: '-%c'\n", optopt);
errflg++;
Expand Down
1 change: 1 addition & 0 deletions src/stl_cone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_cone outputs an STL file of a single cone.\n\n");
fprintf(stderr, "usage: stl_cone [ -r <radius> ] [ -t <top radius> ] [ -h <height> ] [ -s <segments> ] [ <output file> ]\n");
fprintf(stderr, " Outputs an stl file of a cone with the provided radius, top radius, height and number of segments to approximate a circle.\n");
fprintf(stderr, " If the radius or height are omitted, they default to 1. The top radius defaults to 0. If top radius is greater than 0, will output a truncated code. If segments is omitted, it defaults to 32. If no output file is provided, data is sent to stdout. \n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_convex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_convex prints whether an STL file is a convex polyhedron.\n\n");
fprintf(stderr, "usage: stl_convex [ -v ] [ <input file> ]\n");
fprintf(stderr, " Prints whether the input file is a convex polyhedron. If no input file is specified, data is read from stdin. If -v is specified, prints out the Euler characteristic in addition to whether the mesh is convex.\n");
fprintf(stderr, "The Euler characteristic of a polyhedral surface is defined as V - E + F, where V is the number of vertices, E is the number of edges, and F is the number of faces. All convex polyhedra will have an Euler characteristic of 2.\n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_count prints the number of triangles in an STL file.\n\n");
fprintf(stderr, "usage: stl_count [ <input file> ]\n");
fprintf(stderr, " Prints the number of triangles in the provided binary STL file. If no input file is specified, data is read from stdin.\n");
}
Expand Down
1 change: 1 addition & 0 deletions src/stl_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_cube ouputs an STL file of a single cube.\n\n");
fprintf(stderr, "usage: stl_cube [-w <width>] [ <output file> ]\n");
fprintf(stderr, " Outputs an stl file of a cube with the provided width. ");
fprintf(stderr, " If the width is omitted, it defaults to 1. If no output file is provided, data is sent to stdout. \n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_cylinder outputs an STL file of a single cylinder.\n\n");
fprintf(stderr, "usage: stl_cylinder [ -r <radius> ] [ -h <height> ] [ -s <segments> ] [ <output file> ]\n");
fprintf(stderr, " Outputs an stl file of a cylinder with the provided radius, height and number of segments to approximate a circle.\n");
fprintf(stderr, " If the radius or height are omitted, they default to 1. If segments is omitted, it defaults to 32. If no output file is provided, data is sent to stdout. \n");
Expand Down
3 changes: 2 additions & 1 deletion src/stl_empty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_empty outputs an empty STL file.\n\n");
fprintf(stderr, "usage: stl_empty <output file>\n");
fprintf(stderr, " Outputs an empty stl file. ");
fprintf(stderr, " Outputs a properly formatted, but empty stl file (just an 80 byte header and a 0 indicating no triangles). ");
}

int main(int argc, char** argv) {
Expand Down
1 change: 1 addition & 0 deletions src/stl_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_header inspects and modifies the header section of an STL file.\n\n");
fprintf(stderr, "usage: stl_header [-s <header>] [-o <output file>] <input file>\n");
fprintf(stderr, " If both -s and -o flags are specified <input file> is copied to <output\n");
fprintf(stderr, " file> and its header is set to <header>. If -o is not specified and -s is\n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
// rather than just merging.

void print_usage() {
fprintf(stderr, "stl_merge concatenates multiple STL files.\n\n");
fprintf(stderr, "usage: stl_merge [ -o <out file> ] [ <in file1> ... ]\n");
fprintf(stderr, " Merges binary stl files into a single file. If no out file is provided, data is output to stdout.\n");
}
Expand Down
1 change: 1 addition & 0 deletions src/stl_normals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_normals inspects and modifies normal data of an STL file.\n\n");
fprintf(stderr, "usage: stl_normals [ -c ] [ -r ] [ -v ] <in file> [ <out file> ]\n");
fprintf(stderr, " Checks the stored normals against calculated normals based on ordering of vertices.\n"
" -c - if present will ignore the present normal values and calculate them based on the vertex ordering.\n"
Expand Down
1 change: 1 addition & 0 deletions src/stl_sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#include "stl_util.h"

void print_usage() {
fprintf(stderr, "stl_sphere outputs an STL file of a single sphere.\n\n");
fprintf(stderr, "usage: stl_sphere [-r <radius>] [-s <longitudinal segments>] [-t <latitudinal segments>] [ <output file> ]\n");
fprintf(stderr, " Outputs an stl file of a sphere with the provided radius and number of segments. ");
fprintf(stderr, " If the radius is omitted, it defaults to 1. If longitudinal segments is omitted, it defaults to 32. If latitudinal segments is omitted, it defaults to half the longitudinal segments. If no output file is provided, data is sent to stdout. \n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_spreadsheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#include <iostream>

void print_usage() {
fprintf(stderr, "stl_spreadsheet outputs an STL file in a tab delimited text format.\n\n");
fprintf(stderr, "usage: stl_spreadsheet <input file>\n");
fprintf(stderr, " Prints vertex and normal information for every triangle in STL file in a tab delimited format that can be opened as a spreadsheet.\n");
}
Expand Down
1 change: 1 addition & 0 deletions src/stl_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
// won't work with stdout.

void print_usage() {
fprintf(stderr, "stl_threads outputs an STL file with male or female threads per the ISO metric screw thread standard.\n\n");
fprintf(stderr, "usage: stl_threads [ -f ] [ -D <diameter> ] [ -P <pitch> ] [ -a <angle> ]\n"
" [ -h <height> ] [ -s <segments> ] <output file>\n");
fprintf(stderr, " Outputs an stl file with male or female screw threads per the ISO metric \n"
Expand Down
1 change: 1 addition & 0 deletions src/stl_torus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Copyright 2017 by Freakin' Sweet Apps, LLC ([email protected])
#define BUFFER_SIZE 4096

void print_usage() {
fprintf(stderr, "stl_torus outputs an STL file of a single torus.\n\n");
fprintf(stderr, "usage: stl_torus [ -o <outer radius> ] [ -i <inner radius> ] [ -s <segments> ] [ -c <cross sectional segments> ] [ <output file> ]\n");
fprintf(stderr, " Outputs an stl file of a torus with the provided outer radius, inner radius and number of segments.\n");
fprintf(stderr, " If the inner radius is omitted, it defaults to .5. If the outer radius is omitted, it defaults to 1.\n");
Expand Down
1 change: 1 addition & 0 deletions src/stl_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Copyright 2014 by Freakin' Sweet Apps, LLC ([email protected])
// stl_merge *.stl | transform -s 10 > all_cubes_scaled.stl

void print_usage() {
fprintf(stderr, "stl_transform performs any number of transformations to an STL file.\n\n");
fprintf(stderr, "usage: stl_transform [[ <transformation> ] ...] <input file> <output file>\n");
fprintf(stderr, " Performs any number of the following transformations in\n");
fprintf(stderr, " the order they are listed on the command line:\n");
Expand Down

0 comments on commit bd98f62

Please sign in to comment.