<commit_before>#ifndef _HELP_H_
#define _HELP_H_

#include <getopt.h>
#include <iostream>

// forward declaration to break cyclic dependency
int invoke_cmd(const char* cmd, int argc, char** argv);

#define PROGRAM "mpi"

static const char USAGE_MESSAGE[] =
"Usage: " PROGRAM " [--help] <command> [<args>]\n"
"\n"
"Description:\n"
"\n"
"   '" PROGRAM "' is a command-line interface for writing\n"
"   MPI-based shell scripts.\n"
"\n"
"The available commands are:\n"
"\n"
"   help      show usage for specific commands\n"
"\n"
"See '" PROGRAM " help <command>' for help on specific commands.\n";

int cmd_help(int argc, char** argv)
{
	// 'mpi help'

	if (optind >= argc) {
		std::cout << USAGE_MESSAGE;
		return EXIT_SUCCESS;
	}

	// 'mpi help <cmd>'<commit_msg>mpi help: add "Hello, World!" example and commands to be implemented<commit_after>#ifndef _HELP_H_
#define _HELP_H_

#include <getopt.h>
#include <iostream>

// forward declaration to break cyclic dependency
int invoke_cmd(const char* cmd, int argc, char** argv);

#define PROGRAM "mpi"

static const char USAGE_MESSAGE[] =
"Usage: " PROGRAM " [--help] <command> [<args>]\n"
"\n"
"Description:\n"
"\n"
"   '" PROGRAM "' is a command-line interface for writing\n"
"   MPI-based shell scripts.\n"
"\n"
"Synopsis:\n"
"\n"
"   #!/bin/bash\n"
"\n"
"   MPI_FIFO=$(mkfifo cmd_fifo)\n"
"   mpi init $MPI_FIFO &\n"
"   rank=$(mpi rank)\n"
"   if [ $rank -eq 0 ]; then\n"
"      echo 'Hello from Rank 0!' | mpi send --rank 1\n"
"      # prints 'Hello from Rank 1!'\n"
"      mpi recv --rank 1 | cat\n"
"   else\n"
"      echo 'Hello from rank 1!' | mpi send --rank 0\n"
"      # prints 'Hello from Rank 0!'\n"
"      mpi recv --rank 0 | cat\n"
"   fi\n"
"   mpi finalize\n"
"\n"
"The available commands are:\n"
"\n"
"   help      show usage for specific commands\n"
"   init      initialize this MPI rank (starts a daemon)\n"
"   finalize  shutdown MPI this MPI rank (stops daemon)\n"
"   numRanks  get number of ranks in current MPI job\n"
"   rank      get rank of this MPI process\n"
"   recv      receive data from another MPI rank\n"
"   send      send data to another MPI rank\n"
"\n"
"See '" PROGRAM " help <command>' for help on specific commands.\n";

int cmd_help(int argc, char** argv)
{
	// 'mpi help'

	if (optind >= argc) {
		std::cout << USAGE_MESSAGE;
		return EXIT_SUCCESS;
	}

	// 'mpi help <cmd>'
{'fraction_non_alphanumeric': 0.15680473372781065, 'fraction_numerical': 0.0038038884192730348, 'mean_word_length': 3.1672535211267605, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '6292121', 'n_tokens_mistral': 912, 'n_tokens_neox': 861, 'n_words': 287}