<commit_before>#![deny(warnings)]

extern crate extra;

use std::env;
use std::fs;
use std::io;
use extra::io::fail;
use extra::option::OptionalExt;

fn main() {
    let mut stderr = io::stderr();

    if env::args().count() < 2 {
        fail("no arguments.", &mut stderr);
    }

    for ref path in env::args().skip(1) {
        fs::remove_file(path).try(&mut stderr);
    }
}<commit_msg>Add man page to rm, -h and --help options.<commit_after>#![deny(warnings)]

extern crate extra;

use std::env;
use std::fs;
use std::io::{stdout, stderr, Write};
use extra::io::fail;
use extra::option::OptionalExt;

const MAN_PAGE: &'static str = /* @MANSTART{rm} */ r#"
NAME
    rm - delete files

SYNOPSIS
    rm [ -h | --help ] FILE...

DESCRIPTION
    The rm utility deletes the file named by the FILE operand. Multiple file names can be passed.

OPTIONS
    --help, -h
        print this message
"#; /* @MANEND */

fn main() {
    let stdout = stdout();
    let mut stdout = stdout.lock();
    let mut stderr = stderr();

    if env::args().count() == 2 {
        if let Some(arg) = env::args().nth(1) {
            if arg == "--help" || arg == "-h" {
                stdout.write_all(MAN_PAGE.as_bytes()).try(&mut stderr);
                stdout.flush().try(&mut stderr);
                return;
            }
        }
    }

    if env::args().count() < 2 {
        fail("No arguments. Use --help to see the usage.", &mut stderr);
    }

    for ref path in env::args().skip(1) {
        fs::remove_file(path).try(&mut stderr);
    }
}
{'fraction_non_alphanumeric': 0.17340286831812254, 'fraction_numerical': 0.003911342894393742, 'mean_word_length': 2.4650112866817158, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6666515', 'n_tokens_mistral': 533, 'n_tokens_neox': 516, 'n_words': 148}