def pytwis_clt():
    """The main routine of this command-line tool."""
    epilog = '''After launching `pytwis_clt.py`, you will be able to use the following commands:

    * Register a new user:

        127.0.0.1:6379> register {username} {password}

    * Log into a user:  

        127.0.0.1:6379> login {username} {password} 

    * Log out of a user:

        127.0.0.1:6379> logout

    * Change the password:

        127.0.0.1:6379> changepwd {old_password} {new_password} {confirmed_new_password}

    * Get the profile of the current user:

        127.0.0.1:6379> userprofile

    * Post a tweet:

        127.0.0.1:6379> post {tweet}

    * Follow a user:

        127.0.0.1:6379> follow {followee_username}

    * Unfollow a user:

        127.0.0.1:6379> unfollow {followee_username}

    * Get the follower list:

        127.0.0.1:6379> followers

    * Get the following list:

        127.0.0.1:6379> followings

    * Get the timeline:

        127.0.0.1:6379> timeline
        127.0.0.1:6379> timeline {max_tweet_count}

    Note that if a user is logged in, `timeline` will return the user timeline; 
    otherwise `timeline` will return the general timeline.

    * Get the tweets posted by a user:

        127.0.0.1:6379> tweetsby 
        127.0.0.1:6379> tweetsby {username}
        127.0.0.1:6379> tweetsby {username} {max_tweet_count}

    Note that if no username is given, `tweetsby` will return the tweets posted 
    by the currently logged-in user.

    * Exit the program:

        127.0.0.1:6379> exit
        127.0.0.1:6379> quit
    '''
    twis, prompt = get_pytwis(epilog)
    if twis is None:
        return -1

    auth_secret = ['']
    while True:
        try:
            arg_dict = pytwis_command_parser(
                input('Please enter a command '
                      '(register, login, logout, changepwd, userprofile, post, '
                      'follow, unfollow, followers, followings, timeline, tweetsby):\n{}> '\
                      .format(prompt)))
            if arg_dict[pytwis_clt_constants.ARG_COMMAND] == pytwis_clt_constants.CMD_EXIT \
                or arg_dict[pytwis_clt_constants.ARG_COMMAND] == pytwis_clt_constants.CMD_QUIT:
                # Log out of the current user before exiting.
                if auth_secret[0]:
                    pytwis_command_processor(twis, auth_secret,
                                             {pytwis_clt_constants.ARG_COMMAND:
                                              pytwis_clt_constants.CMD_LOGOUT})
                print('pytwis is exiting.')
                return 0

        except ValueError as excep:
            print('Invalid pytwis command: {}'.format(str(excep)),
                  file=sys.stderr)
            continue

        pytwis_command_processor(twis, auth_secret, arg_dict)