idiot 0.9.2
Informative terminal output as you iterate over a callback
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Idiot Library
- Author: Jonathan M. Wilbur [jonathan@wilbur.space](mailto:jonathan@wilbur.space)
- Copyright Year: 2018
- License: MIT License
- Version: 0.9.2
Have a task where you need to iterate a callback over an array of arguments? Use Idiot! Idiot unintrusively inserts into your code to produce beautiful command-line output.
Compile and Install
In build/scripts
there are three scripts you can use to build the library.
When the library is built, it will be located in build/libraries
.
On POSIX-Compliant Machines (Linux, Mac OS X)
Run ./build/scripts/build.sh
.
If you get a permissions error, you need to set that file to be executable
using the chmod
command.
On Windows
Run .\build\scripts\build.bat
from a cmd
or run .\build\scripts\build.ps1
from the PowerShell command line. If you get a warning about needing a
cryptographic signature for the PowerShell script, it is probably because
your system is blocking running unsigned PowerShell scripts. Just run the
other script if that is the case.
Usage
Here is how you use it:
import idiot;
void main ()
{
bool doNothing (size_t index, string[] arguments)
{
return true; // This will always be successful
}
string[] arguments = [
"nothing",
"more nothing",
"still more nothing",
"even more nothing",
"no thing",
"nothing",
"nada"
];
auto idiot = new Idiot!string(&doNothing);
idiot.execute(arguments);
}
The type parameter passed into the Idiot
object is the type of the arguments,
which, in the above case, was a string
.
And here are the configuration options at your disposal:
class Idiot(T)
{
// Output configuration
public bool showFraction = true;
public bool showPercent = true;
public bool showMarginalTime = true;
public bool showCumulativeTime = true;
// Execution configuration
public bool continueOnSuccess = true; // if false, only executes until success occurs
public bool continueOnFailure = true;
public bool continueOnException = true;
public bool delegate (size_t, T[]) callback;
public size_t millisecondsToPauseInBetweenIterations = 0u;
public size_t maximumMillisecondsOfAdditionalRandomPause = 0u;
// ...
}
Future Developments
I would like to make a command-line tools like xargs
with this library.
Contact Me
If you would like to suggest fixes or improvements on this library, please just leave an issue on this GitHub page. If you would like to contact me for other reasons, please email me at [email protected] (My GPG Key) (My TLS Certificate). :boar:
- Registered by Jonathan M. Wilbur
- 0.9.2 released 6 years ago
- JonathanWilbur/idiot-d
- MIT
- Copyright © 2018
- Authors:
- Dependencies:
- none
- Versions:
-
0.9.2 2018-Jan-19 0.9.1 2018-Jan-19 ~master 2018-Jan-19 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
13 downloads total
-
- Score:
- 0.6
- Short URL:
- idiot.dub.pm