<commit_before>simple copy with nshtool
========================
<NAME>, <<EMAIL>>
version 0.0.1x 2010-02-26

== work queues in nshtools.js

nshtools.js provides, among other things, a work queue implementation like the one above (see github.com/rsdoiel/[nshtools](http://github.com/rsdoiel/nshtools). Here's an example of using the work queue to copy a file (e.g. helloworld.txt) you've crearted in your local directory to some place else. It's like a simple quick and dirty installer script copying a source file to a destination file -

copy-helloworld-nshtools.js
----
   #!/usr/bin/env node
   /* Let's load the nshtools module which includes a work queue */
   nshtools = require('nshtools');
   nsh = nshtools.creeateNshtool();
   
   /* Queue the prompt to get the name of the source file. */
   nsh.prompt("Where do I find helloworld.txt (e.g. ./helloworld.txt or /tmp/helloworld.txt)? ", function (response) {
     if (response.trim() === '') {
       nsh.echo("Canceling copy: no source filename provided for copy.");
       process.exit(1);
     }
     nsh.source_filename = response.trim();
   });
   
   /* Queue the prompt to get the name of the destination */
   nsh.prompt("What is the destination name? ", function (response) {
     if (response.trim() === '') {
       nsh.echo("Canceling copy: no destination filename provided for copy.");
     }
     nsh.destination_filename = response.trim();
   });

   /* Make a task to do the copy after the prompts have taken place. */
   nsh.task("Copying " + nsh.source_filename + " to " + nsh.destination_filename, function() {
     nsh.verbose = true;
     nsh.cp(nsh.source_filename, nsh.destination_filename, function () {
       nsh.echo("Copy made!");
     });
   });
   
   /* Finnally we need to run our queued tasks and prompts. */
   nsh.run();

Here's an example of the output of running that program.  Remember nshtools.js needs to be installed where node can find it.  helloworld.txt was in the current work directory and I copied it to /tmp/helloworld.txt.

----

    example.com$ node copy-helloworld-nshtools.js
    Where do I find helloworld.txt (e.g. ./helloworld.txt or /tmp/helloworld.txt)? ../helloworld.txt
    What is the destination name? /tmp/helloworld.txt
    Copying undefined to undefined
    ./helloworld.txt -> /tmp/helloworld.txt
    Copy made!
    example.com$ ls -l /tmp/helloworld.txt 
    -rw-r--r-- 1 xxxxxxx xxxxxxx 29 2010-02-22 21:12 /tmp/helloworld.txt

----
<commit_msg>link still wonki<commit_after>simple copy with nshtool
========================
<NAME>, <<EMAIL>>
version 0.0.1x 2010-02-26

== work queues in nshtools.js

nshtools.js provides, among other things, a work queue implementation like the one above (see github.com/rsdoiel/link:http://github.com/rsdoiel/nshtools[nshtools]). Here's an example of using the work queue to copy a file (e.g. helloworld.txt) you've crearted in your local directory to some place else. It's like a simple quick and dirty installer script copying a source file to a destination file -

copy-helloworld-nshtools.js
----
   #!/usr/bin/env node
   /* Let's load the nshtools module which includes a work queue */
   nshtools = require('nshtools');
   nsh = nshtools.creeateNshtool();
   
   /* Queue the prompt to get the name of the source file. */
   nsh.prompt("Where do I find helloworld.txt (e.g. ./helloworld.txt or /tmp/helloworld.txt)? ", function (response) {
     if (response.trim() === '') {
       nsh.echo("Canceling copy: no source filename provided for copy.");
       process.exit(1);
     }
     nsh.source_filename = response.trim();
   });
   
   /* Queue the prompt to get the name of the destination */
   nsh.prompt("What is the destination name? ", function (response) {
     if (response.trim() === '') {
       nsh.echo("Canceling copy: no destination filename provided for copy.");
     }
     nsh.destination_filename = response.trim();
   });

   /* Make a task to do the copy after the prompts have taken place. */
   nsh.task("Copying " + nsh.source_filename + " to " + nsh.destination_filename, function() {
     nsh.verbose = true;
     nsh.cp(nsh.source_filename, nsh.destination_filename, function () {
       nsh.echo("Copy made!");
     });
   });
   
   /* Finnally we need to run our queued tasks and prompts. */
   nsh.run();

----

Here's an example of the output of running that program.  Remember nshtools.js needs to be installed where node can find it.  helloworld.txt was in the current work directory and I copied it to /tmp/helloworld.txt.

----

    example.com$ node copy-helloworld-nshtools.js
    Where do I find helloworld.txt (e.g. ./helloworld.txt or /tmp/helloworld.txt)? ../helloworld.txt
    What is the destination name? /tmp/helloworld.txt
    Copying undefined to undefined
    ./helloworld.txt -> /tmp/helloworld.txt
    Copy made!
    example.com$ ls -l /tmp/helloworld.txt 
    -rw-r--r-- 1 xxxxxxx xxxxxxx 29 2010-02-22 21:12 /tmp/helloworld.txt

----

{'fraction_non_alphanumeric': 0.12981253779479943, 'fraction_numerical': 0.010884902237452126, 'mean_word_length': 3.0178137651821864, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1442810', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1546, 'n_words': 520}