<commit_before>import {
    search,
    getArtistAlbumsList,
    getTracksList,
    Album,
    ItemType
} from './api';
import {
    askSearchTerm,
    chooseFromSearchResults,
    chooseFromAlbums
} from './inquirer-ui';
import { playTracks } from './cli-player';
import { downloadTracks } from './downloader';
import yargs = require('yargs');

const download = async (directory: string) => {
    const searchResultItem = await askSearchTerm();
    const tracksList = await getTracksList(searchResultItem);
    await downloadTracks(directory, tracksList);
};

const play = async () => {
    const searchResultItem = await askSearchTerm();
    let selectedItem;
    if (searchResultItem.itemType === ItemType.Artist) {
        const artistAlbumsList = await getArtistAlbumsList(searchResultItem);
        selectedItem = await chooseFromAlbums(artistAlbumsList);
    } else {
        selectedItem = searchResultItem;
    }
    const tracksList = await getTracksList(selectedItem);
    await playTracks(tracksList);<commit_msg>add 2step search to [get] command also<commit_after>import {
    search,
    getArtistAlbumsList,
    getTracksList,
    Album,
    ItemType,
    Track
} from './api';
import {
    askSearchTerm,
    chooseFromSearchResults,
    chooseFromAlbums
} from './inquirer-ui';
import { playTracks } from './cli-player';
import { downloadTracks } from './downloader';
import yargs = require('yargs');

const getTracksListInteractively = async (): Promise<Array<Track>> => {
    const searchResultItem = await askSearchTerm();
    let selectedItem;
    if (searchResultItem.itemType === ItemType.Artist) {
        const artistAlbumsList = await getArtistAlbumsList(searchResultItem);
        selectedItem = await chooseFromAlbums(artistAlbumsList);
    } else {
        selectedItem = searchResultItem;
    }
    return getTracksList(selectedItem);
}

const download = async (directory: string) => {
    const tracksList = await getTracksListInteractively();
    await downloadTracks(directory, tracksList);
};

const play = async () => {
    const tracksList = await getTracksListInteractively();
    await playTracks(tracksList);
{'fraction_non_alphanumeric': 0.10433162552398696, 'fraction_numerical': 0.0004657661853749418, 'mean_word_length': 3.960739030023095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2034119', 'n_tokens_mistral': 631, 'n_tokens_neox': 616, 'n_words': 146}