<commit_before>__Sash is a Secure Shell wrapper which uses `aws-cli` to find an instance's IP and PEM file by its name__
sash
====

Prerequisites
-------------

1. Install [AWS Unified CLI](https://github.com/aws/aws-cli)
2. Make sure you have `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` set in your environment
3. Put all your PEM files under `~/.aws`

Installation
------------

**Ubuntu/Linux**

    git clone <EMAIL>:uriagassi/sash.git
    cd sash
    make install
    echo "source ~/.local/bin/sash.sh" >> ~/.bashrc
    source ~/.bashrc
    
**Mac**

    git clone <EMAIL>:uriagassi/sash.git
    cd sash
    make install
    echo "source ~/.local/bin/sash.sh" >> ~/.bash_profile
    echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile
    echo "export LANG=en_US.UTF-8" >> ~/.bash_profile
    source ~/.bash_profile
    

Usage
-----

**SSH Connect**

    sash my-machine-name
    
Also supports auto-complete (press `TAB` to get available machine names)

To refresh the machine name cache for the autocomplete run

    clear_sash
    <commit_msg>support `list` flag to show running instances and indexes<commit_after>__Sash is a Secure Shell wrapper which uses `aws-cli` to find an instance's IP and PEM file by its name__
sash
====

Prerequisites
-------------

1. Install [AWS Unified CLI](https://github.com/aws/aws-cli)
2. Make sure you have `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` set in your environment
3. Put all your PEM files under `~/.aws`

Installation
------------

**Ubuntu/Linux**

    git clone <EMAIL>:uriagassi/sash.git
    cd sash
    make install
    echo "source ~/.local/bin/sash.sh" >> ~/.bashrc
    source ~/.bashrc
    
**Mac**

    git clone <EMAIL>:uriagassi/sash.git
    cd sash
    make install
    echo "source ~/.local/bin/sash.sh" >> ~/.bash_profile
    echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile
    echo "export LANG=en_US.UTF-8" >> ~/.bash_profile
    source ~/.bash_profile
    

Usage
-----

**SSH Connect**

    sash my-machine-name
    
Also supports auto-complete (press `TAB` to get available machine names)

To refresh the machine name cache for the autocomplete run

    clear_sash

**Multiple instances with the same name**

If there are multiple instances with the same name, the first instance returned will be selected. If you want to select another, you can do it
by indicating the instance's appearance index (starting from one) as a second parameter.

For example:

    sash my-machine-name 3

will connect to the third instance listed with the name `my-machine-name`.

To see which instances are listed, and in what order, add `list` as the second parameter:

    > sash my-machine-name list
    1) my-machine-name (214.35.22.10)
    2) my-machine-name (214.35.22.11)
    3) my-machine-name (214.35.22.12)

**Using wildcards**

You can call `sash` with wildcards (`*`). This will select all instances matching the pattern, and connect to the one in the index indicated
(or the first by default).

    > sash my-*-name list
    1) my-new-machine-name (214.35.23.55)
    2) my-old-machine-name (214.32.20.10)
    3) my-machine-name (214.32.22.10)

    > sash my-*-name 2
    Connecting to my-old-machine-name (214.32.20.10)
    ...
    
{'fraction_non_alphanumeric': 0.12719298245614036, 'fraction_numerical': 0.02537593984962406, 'mean_word_length': 2.8609431680773882, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 7, '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': '389827', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1052, 'n_words': 366}