<commit_before>#![crate_name = "uu_dircolors"]

// This file is part of the uutils coreutils package.
//
// (c) <NAME> <<EMAIL>>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//

extern crate libc;
extern crate glob;
extern crate getopts;

#[macro_use]
extern crate uucore;

use getopts::Options;

use std::fs::File;
use std::io::{BufRead, BufReader, Write};
use std::borrow::Borrow;
use std::env;

static NAME: &'static str = "dircolors";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");

mod colors;
use colors::INTERNAL_DB;

#[derive(PartialEq, Debug)]
pub enum OutputFmt {
    Shell,
    CShell,
    Unknown,
}

pub fn guess_syntax() -> OutputFmt {
    use std::path;
    match env::var("SHELL") {
        Ok(ref s) if !s.is_empty() => {
            if let Some(last) = s.rsplit(path::MAIN_SEPARATOR).next() {
                if last == "csh" || last == "tcsh" {
                    OutputFmt::CShell
                } else {
                    OutputFmt::Shell
                }
            } else {
                OutputFmt::Shell<commit_msg>dircolors: extract shell name from $SHELL properly<commit_after>#![crate_name = "uu_dircolors"]

// This file is part of the uutils coreutils package.
//
// (c) <NAME> <<EMAIL>>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//

extern crate libc;
extern crate glob;
extern crate getopts;

#[macro_use]
extern crate uucore;

use getopts::Options;

use std::fs::File;
use std::io::{BufRead, BufReader, Write};
use std::borrow::Borrow;
use std::env;

static NAME: &'static str = "dircolors";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");

mod colors;
use colors::INTERNAL_DB;

#[derive(PartialEq, Debug)]
pub enum OutputFmt {
    Shell,
    CShell,
    Unknown,
}

pub fn guess_syntax() -> OutputFmt {
    use std::path::Path;
    match env::var("SHELL") {
        Ok(ref s) if !s.is_empty() => {
            let shell_path: &Path = s.as_ref();
            if let Some(name) = shell_path.file_name() {
                if name == "csh" || name == "tcsh" {
                    OutputFmt::CShell
                } else {
                    OutputFmt::Shell
                }
            } else {
                OutputFmt::Shell
{'fraction_non_alphanumeric': 0.1354784081287045, 'fraction_numerical': 0.0, 'mean_word_length': 2.58030303030303, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '3596615', 'n_tokens_mistral': 781, 'n_tokens_neox': 770, 'n_words': 221}