GithubHelp home page GithubHelp logo

donnemartin / saws Goto Github PK

View Code? Open in Web Editor NEW
5.2K 107.0 279.0 5.5 MB

A supercharged AWS command line interface (CLI).

License: Other

Python 99.25% Shell 0.60% Dockerfile 0.14%
aws aws-cli cloud python terminal shell utility utilities client cli

saws's Introduction

SAWS

Build Status Documentation Status Dependency Status

PyPI version PyPI License

Motivation

AWS CLI

Although the AWS CLI is a great resource to manage your AWS-powered services, it's tough to remember usage of:

  • 70+ top-level commands
  • 2000+ subcommands
  • Countless command-specific options
  • Resources such as instance tags and buckets

SAWS: A Supercharged AWS CLI

SAWS aims to supercharge the AWS CLI with features focusing on:

  • Improving ease-of-use
  • Increasing productivity

Under the hood, SAWS is powered by the AWS CLI and supports the same commands and command structure.

SAWS and AWS CLI Usage:

aws <command> <subcommand> [parameters] [options]

SAWS features:

  • Auto-completion of:
    • Commands
    • Subcommands
    • Options
  • Auto-completion of resources:
  • Customizable shortcuts
  • Fuzzy completion of resources and shortcuts
  • Fish-style auto-suggestions
  • Syntax and output highlighting
  • Execution of shell commands
  • Command history
  • Contextual help
  • Toolbar options

SAWS is available for Mac, Linux, Unix, and Windows.

Index

Features

Installation and Tests

Misc

Syntax and Output Highlighting

You can control which theme to load for syntax highlighting by updating your ~/.sawsrc file:

# Visual theme. Possible values: manni, igor, xcode, vim, autumn, vs, rrt,
# native, perldoc, borland, tango, emacs, friendly, monokai, paraiso-dark,
# colorful, murphy, bw, pastie, paraiso-light, trac, default, fruity
theme = vim

Auto-Completion of Commands, Subcommands, and Options

SAWS provides smart autocompletion as you type. Entering the following command will interactively list and auto-complete all subcommands specific only to ec2:

aws ec2

Auto-Completion of AWS Resources

In addition to the default commands, subcommands, and options the AWS CLI provides, SAWS supports auto-completion of your AWS resources. Currently, bucket names, instance ids, and instance tags are included, with additional support for more resources under development.

S3 Buckets

Option for s3api:

--bucket

Sample Usage:

aws s3api get-bucket-acl --bucket

Syntax for s3:

s3://

Sample Usage:

aws s3 ls s3://

Note: The example below demonstrates the use of fuzzy resource completion:

EC2 Instance Ids

Option for ec2:

--instance-ids

Sample Usage:

aws ec2 describe-instances --instance-ids
aws ec2 ls --instance-ids

Note: The ls command demonstrates the use of customizable shortcuts:

EC2 Instance Tags

Option for ec2:

--ec2-tag-key
--ec2-tag-value

Sample Usage:

aws ec2 ls --ec2-tag-key
aws ec2 ls --ec2-tag-value

Tags support wildcards with the * character.

Note: ls, --ec2-tag-value, and --ec2-tag-key demonstrate the use of customizable shortcuts:

TODO: Add More Resources

Feel free to submit an issue or a pull request if you'd like support for additional resources.

Customizable Shortcuts

The ~/.saws.shortcuts file contains shortcuts that you can modify. It comes pre-populated with several handy shortcuts out of the box. You can combine shortcuts with fuzzy completion for even less keystrokes. Below are a few examples.

List all EC2 instances:

aws ec2 ls

List all running EC2 instances:

aws ec2 ls --ec2-state running  # fuzzy shortcut: aws ecstate

List all EC2 instances with a matching tag (supports wildcards *):

aws ec2 ls --ec2-tag-key    # fuzzy shortcut: aws ectagk
aws ec2 ls --ec2-tag-value  # fuzzy shortcut: aws ectagv

List EC2 instance with matching id:

aws ec2 ls --instance-ids  # fuzzy shortcut: aws eclsi

List all DynamoDB tables:

aws dynamodb ls  # fuzzy shortcut: aws dls

List all EMR clusters:

aws emr ls  # fuzzy shortcut: aws emls

Add/remove/modify shortcuts in your ~/.saws.shortcuts file to suit your needs.

Feel free to submit:

  • An issue to request additional shortcuts
  • A pull request if you'd like to share your shortcuts (see contributing guidelines)

Fuzzy Resource and Shortcut Completion

To toggle fuzzy completion of AWS resources and shortcuts, use F3 key.

Sample fuzzy shortcuts to start and stop EC2 instances:

aws ecstop
aws ecstart

Note: Fuzzy completion currently only works with AWS resources and shortcuts.

Fish-Style Auto-Suggestions

SAWS supports Fish-style auto-suggestions. Use the right arrow key to complete a suggestion.

Executing Shell Commands

SAWS allows you to execute shell commands from the saws> prompt.

Command History

SAWS keeps track of commands you enter and stores them in ~/.saws-history. Use the up and down arrow keys to cycle through the command history.

Contextual Help

SAWS supports contextual command line help and contextual web docs.

Contextual Command Line Help

The help command is powered by the AWS CLI and outputs help within the command line.

Usage:

aws <command> <subcommand> help

Contextual Web Docs

Sometimes you're not quite sure what specific command/subcommand/option combination you need to use. In such cases, browsing through several combinations with the help command line is cumbersome versus browsing the online AWS CLI docs through a web browser.

SAWS supports contextual web docs with the docs command or the F9 key. SAWS will display the web docs specific to the currently entered command and subcommand.

Usage:

aws <command> <subcommand> docs

Toolbar Options

SAWS supports a number of toolbar options:

Windows Support

SAWS has been tested on Windows 7 and Windows 10.

On Windows, the .sawsrc file can be found in %userprofile%. For example:

C:\Users\dmartin\.sawsrc

Although you can use the standard Windows command prompt, you'll probably have a better experience with either cmder or conemu.

Installation

Pip Installation

PyPI version PyPI

SAWS is hosted on PyPI. The following command will install SAWS along with dependencies such as the AWS CLI:

$ pip install saws

You can also install the latest SAWS from GitHub source which can contain changes not yet pushed to PyPI:

$ pip install git+https://github.com/donnemartin/saws.git

If you are not installing in a virtualenv, run with sudo:

$ sudo pip install saws

Once installed, start SAWS:

$ saws

Virtual Environment and Docker Installation

It is recommended that you install Python packages in a virtualenv to avoid potential issues with dependencies or permissions.

To view SAWS virtualenv and Docker installation instructions, click here.

Mac OS X 10.11 El Capitan Users

There is a known issue with Apple and its included python package dependencies (more info at pypa/pip#3165). We are investigating ways to fix this issue but in the meantime, to install saws, you can run:

$ sudo pip install saws --upgrade --ignore-installed six

AWS Credentials and Named Profiles

Configure your credentials with the AWS CLI:

$ aws configure

If you'd like to use a specific named profile with SAWS, run the following commands on OS X, Linux, or Unix:

$ export AWS_DEFAULT_PROFILE=user1
$ saws

Or as a one-liner:

$ AWS_DEFAULT_PROFILE=user1 saws

Windows users can run the following commands:

> set AWS_DEFAULT_PROFILE=user1
> saws

Command line options for starting SAWS with a specific profile are under development. For more details on how to install and configure the AWS CLI, refer to the following documentation.

Supported Python Versions

  • Python 2.6
  • Python 2.7
  • Python 3.3
  • Python 3.4
  • Pypy

Light testing indicates that SAWS also seems to be compatible with Python 3.5.

Pypy3 is not supported due to lack of support from boto.

Supported Platforms

  • Mac OS X
    • Tested on OS X 10.10
  • Linux, Unix
    • Tested on Ubuntu 14.04 LTS
  • Windows
    • Tested on Windows 7 and 10

Developer Installation

If you're interested in contributing to SAWS, run the following commands:

$ git clone https://github.com/donnemartin/saws.git
$ pip install -e .
$ pip install -r requirements-dev.txt
$ saws

Continuous Integration

Build Status

Continuous integration details are available on Travis CI.

Dependencies Management

Dependency Status

Dependencies management details are available on Gemnasium.

Unit Tests and Code Coverage

Run unit tests in your active Python environment:

$ python tests/run_tests.py

Run unit tests with tox on multiple Python environments:

$ tox

Documentation

Documentation Status

Source code documentation is available on Readthedocs.org.

Run the following to build the docs:

$ scripts/update_docs.sh

Contributing

Contributions are welcome!

Review the Contributing Guidelines for details on how to:

  • Submit issues
  • Submit pull requests

Credits

Contact Info

Feel free to contact me to discuss any issues, questions, or comments.

License

I am providing code and resources in this repository to you under an open source license. Because this is my personal repository, the license you receive to my code and resources is from me and not my employer (Facebook).

Copyright 2015 Donne Martin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

saws's People

Contributors

cclauss avatar cliveza avatar donnemartin avatar frosforever avatar jonathanslenders avatar mlimaloureiro avatar stilvoid avatar svieira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saws's Issues

Support history manipulation through .bash_history

Feature request: use saws autocompletion but delegate execution of the command to bash or the underlining shell.

For example, right now this cmd doesn't work:
aws s3 ls | less

There are use cases in which you would want to manipulate the output of an aws cmd.

Also it would be nice if the cmds executed in saws were to end up in the history file so that they can be manipulated at a later time. Especially since that there's no way of getting the saws history.

Thanks for this project.

Improve support for piping commands

Currently within SAWS, you can do some piping of commands such as:

saws> aws ec2 ls > instances.txt

and view (one screen at a time) instances.txt within SAWS with:

saws> less instances.txt

However, not all piping is supported. For example you can't do the following:

saws> aws ec2 ls | less

In saws.py, changing from:

subprocess.call()

to

process = pexpect.spawn()
process.interact()

seems to allow support for this, but pexpect is not supported under Windows. WExpect is dubbed as "pexpect for Windows" and might do the trick.

Thanks to krues8dr on Reddit for the suggestion.

Fuzzy completions are sometimes showing incorrect completions for built-in commands and subcommands

As mentioned in the README: Fuzzy completions are currently only available for shortcuts and resources.

Entering:

aws elb

will cause all the elb subcommands to appear.

Selecting one of the subcommands such as create-load-balancer rewrites the original command, leaving you with an invalid command:

aws create-load-balancer

In the future it might be helpful to extend fuzzy completions to work well with commands, subcommands, and options, although this might need some work on the underlying AWS CLI dependency.

Color scheme not good with white background

Light gray on white is hard to read:

image

The documentation on the README.md does not mention any way of changing the color. I tried to access the in-app documentation with the F9 key, but that's already mapped to Exposรฉ on my OS X machine (which I might file as a separate issue).

Error after installing on Mac

Installed using sudo -H pip install saws, after seeing this comment:

The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Running saws now yields this error:

$ saws
Traceback (most recent call last):
  File "/usr/local/bin/saws", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: pygments>=2.0.2

Mac OS 10.9.5, Python 2.7.5

enum34 shouldn't be installed on Python 3.4+

I am running OSX with Python 3.5.

When I try to install saws using pip, I get:

victorhooi@thadeus ~> pip3 install saws
Collecting saws
  Using cached saws-0.2.1.tar.gz
Collecting awscli>=1.7.46 (from saws)
  Using cached awscli-1.8.12-py2.py3-none-any.whl
Collecting click>=4.0 (from saws)
  Using cached click-5.1-py2.py3-none-any.whl
Collecting configobj>=5.0.6 (from saws)
  Using cached configobj-5.0.6.tar.gz
Collecting enum34>=1.0.4 (from saws)
  Using cached enum34-1.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/private/var/folders/9l/r3dzz8551579drqy2j8d6gwm0000gn/T/pip-build-cdj3eth2/enum34/enum/__init__.py", line 371, in __getattr__
        return cls._member_map_[name]
    KeyError: '_convert'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "/usr/local/lib/python3.5/site-packages/setuptools/__init__.py", line 12, in <module>
        from setuptools.extension import Extension
      File "/usr/local/lib/python3.5/site-packages/setuptools/extension.py", line 8, in <module>
        from .dist import _get_unpatched
      File "/usr/local/lib/python3.5/site-packages/setuptools/dist.py", line 16, in <module>
        from setuptools.depends import Require
      File "/usr/local/lib/python3.5/site-packages/setuptools/depends.py", line 6, in <module>
        from setuptools import compat
      File "/usr/local/lib/python3.5/site-packages/setuptools/compat.py", line 45, in <module>
        import http.client as httplib
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 71, in <module>
        import email.parser
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser, BytesFeedParser
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/feedparser.py", line 27, in <module>
        from email import message
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 16, in <module>
        from email import utils
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/utils.py", line 29, in <module>
        import socket
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/socket.py", line 73, in <module>
        IntEnum._convert(
      File "/private/var/folders/9l/r3dzz8551579drqy2j8d6gwm0000gn/T/pip-build-cdj3eth2/enum34/enum/__init__.py", line 373, in __getattr__
        raise AttributeError(name)
    AttributeError: _convert

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/9l/r3dzz8551579drqy2j8d6gwm0000gn/T/pip-build-cdj3eth2/enum34

It seems that enum34 doesn't work on Python 3.5:

https://bitbucket.org/stoneleaf/enum34/issues/5/enum34-incompatible-with-python-35

In fact, I don't think it makes sense to install enum34 on Python 3.4+ anyway.

Is there some way to resolve this so that saws will install on Python 3.4 and upwards?

Only add ordereddict on Python < 2.7

Hey, I don't usually do Python so I might be wrong but shouldn't ordereddict be only added to the list of deps when the version of Python is below 2.7?:

if sys.version_info < (2, 7):
    requirements.append('ordereddict')

Ability to specify endpoint url in config

I'm not quite sure if saws is committed to using the exact same configuration syntax as the aws-cli tools.

I reported this feature request on that a while ago:
aws/aws-cli#1270

Nothing has happened there yet but I'm hoping that saws might be more willing to incorporate this feature.

I'm copying the text from the above feature request here:

Currently I don't seem to be able to specify an endpoint URL in my profile. I always have to specify the --endpoint-url option on the command line.

I would like to be able to do something like the following (in my ~/.aws/config file):

[default]
region = us-east-1
output = json

[profile nextcode]
region = myregion-1a
output = json
endpoint-url = http://c.my.other.aws.compatable.service.com

The reason for requesting this is that we use an EC2 compatable infrastructure manager (http://www.qstack.com) which I would like to use aws-cli or saws for managing. The problem is that for aws-cli I need to specify the --endpoint-url parameter every time on the command line, which is annoying. Instead I would like to be able to put it into the profile in the configuration file.

Support MFA

Hi,

I just tested your setup and apparently saws does not support multi factor authentication for profiles. I'd highly request that as a feature.

Cheers!

Support Python 2.6

OrderedDict is not available in 2.6.

pip install ordereddict

Change imports:

try:
    from collections import OrderedDict
except:
    from ordereddict import OrderedDict

UnicodeDecodeError: 'ascii' codec can't decode byte

Hi,

I just installed SAWS on my local machine on which I already used the AWS CLI before. (Thus it should be configured correctly)
After starting SAWS I got the following output:

No resource cache found
Refreshing resources...
  Refreshing instance ids...
  Refreshing instance tags...
Traceback (most recent call last):
  File "/usr/local/bin/saws", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 700, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 680, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 508, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/saws/main.py", line 39, in cli
    saws = Saws()
  File "/usr/local/lib/python2.7/dist-packages/saws/saws.py", line 93, in __init__
    shortcut_match=self.get_shortcut_match())
  File "/usr/local/lib/python2.7/dist-packages/saws/completer.py", line 95, in __init__
    self.refresh_resources()
  File "/usr/local/lib/python2.7/dist-packages/saws/completer.py", line 133, in refresh_resources
    self.resources.refresh(force_refresh)
  File "/usr/local/lib/python2.7/dist-packages/saws/resources.py", line 149, in refresh
    self.query_instance_tag_values()
  File "/usr/local/lib/python2.7/dist-packages/saws/resources.py", line 205, in query_instance_tag_values
    self.instance_tag_values = set(output.split('\t'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9953: ordinal not in range(128)

I'm using Ubuntu 14.04 with aws --version:
aws-cli/1.8.12 Python/2.7.6 Linux/3.13.0-65-generic

Command History Improvement

Honestly, fantastic work and so many positives. The only thing I've found that would be annoying for every day usage is the command history format. Could you make it so simply typing "history" at the saws prompt displays a list of the commands used to just copy out into a script as required? Right now it would be a bit of a pain because of the + formatting.

Completions should be case insensitive

Some AWS options are in all caps, others are not. Currently completions fail if the user types the wrong case.

[ec2_states]: 6
pending
running
shutting-down
stopped
stopping
terminated
[cluster_states]: 7
STARTING
BOOTSTRAPPING
RUNNING
WAITING
TERMINATING
TERMINATED
TERMINATED_WITH_ERRORS

ImportError: No module named dateutil.parser

I installed saws using pip like the documentation states:

pip install saws

When I first try to run it I get this error:

Traceback (most recent call last):
  File "/usr/local/bin/saws", line 7, in <module>
    from saws.main import cli
  File "/usr/local/lib/python2.7/site-packages/saws/main.py", line 20, in <module>
    from .saws import Saws
  File "/usr/local/lib/python2.7/site-packages/saws/saws.py", line 31, in <module>
    from awscli import completer as awscli_completer
  File "/usr/local/lib/python2.7/site-packages/awscli/completer.py", line 12, in <module>
    import awscli.clidriver
  File "/usr/local/lib/python2.7/site-packages/awscli/clidriver.py", line 16, in <module>
    import botocore.session
  File "/usr/local/lib/python2.7/site-packages/botocore/session.py", line 26, in <module>
    import botocore.credentials
  File "/usr/local/lib/python2.7/site-packages/botocore/credentials.py", line 22, in <module>
    from dateutil.parser import parse
ImportError: No module named dateutil.parser

I checked to see if dateutil was installed and pip thinks it is:

$ pip install python-dateutil
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil)

I then tried to upgrade it just in case and pip thinks it is up to date:

$ pip install --upgrade python-dateutil
Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/site-packages
Requirement already up-to-date: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil)

Is this possibly a different dependency that is missing or is my environment borked?

Python 3.5 Issue

Collecting configobj>=5.0.6 (from saws->-r requirements.txt (line 38))
  Using cached configobj-5.0.6.tar.gz
Collecting enum34>=1.0.4 (from saws->-r requirements.txt (line 38))
  Using cached enum34-1.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/private/var/folders/cb/cxxqz_g94jd1x5tjwrklxgd00000gn/T/pip-build-9jvu7ws4/enum34/enum/__init__.py", line 371, in __getattr__
        return cls._member_map_[name]
    KeyError: '_convert'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "/Users/username/.pyenv/versions/aws/lib/python3.5/site-packages/setuptools/__init__.py", line 12, in <module>
        from setuptools.extension import Extension
      File "/Users/username/.pyenv/versions/aws/lib/python3.5/site-packages/setuptools/extension.py", line 8, in <module>
        from .dist import _get_unpatched
      File "/Users/username/.pyenv/versions/aws/lib/python3.5/site-packages/setuptools/dist.py", line 16, in <module>
        from setuptools.depends import Require
      File "/Users/username/.pyenv/versions/aws/lib/python3.5/site-packages/setuptools/depends.py", line 6, in <module>
        from setuptools import compat
      File "/Users/username/.pyenv/versions/aws/lib/python3.5/site-packages/setuptools/compat.py", line 45, in <module>
        import http.client as httplib
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/http/client.py", line 71, in <module>
        import email.parser
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser, BytesFeedParser
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/email/feedparser.py", line 27, in <module>
        from email import message
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/email/message.py", line 16, in <module>
        from email import utils
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/email/utils.py", line 29, in <module>
        import socket
      File "/Users/username/.pyenv/versions/3.5.0/lib/python3.5/socket.py", line 73, in <module>
        IntEnum._convert(
      File "/private/var/folders/cb/cxxqz_g94jd1x5tjwrklxgd00000gn/T/pip-build-9jvu7ws4/enum34/enum/__init__.py", line 373, in __getattr__
        raise AttributeError(name)
    AttributeError: _convert

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cb/cxxqz_g94jd1x5tjwrklxgd00000gn/T/pip-build-9jvu7ws4/enum34

Cannot install on OSX 10.9.5

Hi, first of all, amazing idea, I hope I could try it soon!

I'm getting an error when trying to install saws:

$ pip install saws
Collecting saws
  Using cached saws-0.2.1.tar.gz
Collecting awscli>=1.7.46 (from saws)
  Using cached awscli-1.8.6-py2.py3-none-any.whl
Collecting click>=4.0 (from saws)
  Using cached click-5.1-py2.py3-none-any.whl
Collecting configobj>=5.0.6 (from saws)
  Using cached configobj-5.0.6.tar.gz
Collecting enum34>=1.0.4 (from saws)
  Using cached enum34-1.0.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/private/var/folders/f4/_lb074qs3f3cqgl3jnhsc1840000gn/T/pip-build-losha7bj/enum34/enum/__init__.py", line 371, in __getattr__
        return cls._member_map_[name]
    KeyError: '_convert'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "/usr/local/lib/python3.5/site-packages/setuptools/__init__.py", line 12, in <module>
        from setuptools.extension import Extension
      File "/usr/local/lib/python3.5/site-packages/setuptools/extension.py", line 8, in <module>
        from .dist import _get_unpatched
      File "/usr/local/lib/python3.5/site-packages/setuptools/dist.py", line 16, in <module>
        from setuptools.depends import Require
      File "/usr/local/lib/python3.5/site-packages/setuptools/depends.py", line 6, in <module>
        from setuptools import compat
      File "/usr/local/lib/python3.5/site-packages/setuptools/compat.py", line 45, in <module>
        import http.client as httplib
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 71, in <module>
        import email.parser
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser, BytesFeedParser
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/feedparser.py", line 27, in <module>
        from email import message
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 16, in <module>
        from email import utils
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/utils.py", line 29, in <module>
        import socket
      File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/socket.py", line 73, in <module>
        IntEnum._convert(
      File "/private/var/folders/f4/_lb074qs3f3cqgl3jnhsc1840000gn/T/pip-build-losha7bj/enum34/enum/__init__.py", line 373, in __getattr__
        raise AttributeError(name)
    AttributeError: _convert

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/f4/_lb074qs3f3cqgl3jnhsc1840000gn/T/pip-build-losha7bj/enum34

I'm running OSX 10.9.5, and I've tried with Python 2.7.5 and Python 3.5.0. Thanks.

Support for --region and --profile

The AWS config file allows for multiple profiles and specifying a particular region if you're in more than one. This allows for having a single configuration file which holds credentials for multiple AWS accounts.

As I've got the [default] entry disabled by default, saws wouldn't function properly. At the moment I've set a particular profile and region as a default just to play around, and it looks pretty nice, but being able to specify profile and region when launching saws would be hugely helpful. (Alternately, if the functionality exists, and I just couldn't figure it out...my apologies.)

Using grep on ls with args doesn't work

Using the ls without args works but in this cases it doesn't, for instance

saws> aws ec2 ls --ec2-tag-value somevalue | grep IpAddress
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
    [-e pattern] [-f file] [--binary-files=value] [--color=when]
    [--context[=num]] [--directories=action] [--label] [--line-buffered]
    [--null] [pattern] [file ...]

Error parsing parameter '--filters': Expected: '=', received: 'EOF' for input:
somevalue

Scan for resources in the background

At the moment saws is scanning the resources at startup, which slows down the start process.

That could be done on a different thread, so the data would be populated in the background and maybe also in parallel for multiple services, without blocking the UI.

Should be compatible with already installed awscli

In the log spew, I see
Downloading/unpacking awscli>=1.7.46 (from saws) Downloading awscli-1.8.6-py2.py3-none-any.whl (780kB): 780kB downloaded

But I already have awscli installed and configured

then I get this error IOError: [Errno 13] Permission denied: '/usr/local/bin/aws'

It would be great if you could detect if awscli is installed and skip that step.

Add option to customise prompt

I think it would be good to allow the user to customise their prompt to display additional information

A really good example of this could be allowing you to display the current profile in the prompt when you launch saws with AWS_PROFILE or AWS_DEFAULT_PROFILE set.

for example, with profile set:

$ AWS_PROFILE=myprofile saws
saws[myprofile]> 

without profile set:

$ saws
saws> 

Saws exits when aws is working in the background then terminated with Control-C.

Example, if I run following command:

aws route53 list-hosted-zones

or any command that takes time... if I want to exit I'll probably use "Control+c" (or Alt+c in linux).
The problem is that I want to stop aws command and not saws. With this command, saws exits

CTraceback (most recent call last):
  File "/usr/local/bin/pygmentize", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/pygments/cmdline.py", line 505, in main
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/usr/local/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 48, in main
    return driver.main()
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 183, in main
    return main_inner(popts, args, usage)
  File "/Library/Python/2.7/site-packages/pygments/cmdline.py", line 380, in main_inner
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 369, in __call__
    code = sys.stdin.read()
KeyboardInterrupt
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 538, in __call__
    call_parameters, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 662, in invoke
    **parameters)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 268, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Python/2.7/site-packages/botocore/client.py", line 322, in _make_api_call
    operation_model, request_dict)
  File "/Library/Python/2.7/site-packages/botocore/endpoint.py", line 111, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Library/Python/2.7/site-packages/botocore/endpoint.py", line 138, in _send_request
    request, operation_model, attempts)
  File "/Library/Python/2.7/site-packages/botocore/endpoint.py", line 168, in _get_response
    proxies=self.proxies, timeout=self.timeout)
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
    self._validate_conn(conn)
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
    conn.connect()
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 204, in connect
    conn = self._new_conn()
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 134, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/Library/Python/2.7/site-packages/botocore/vendored/requests/packages/urllib3/util/connection.py", line 78, in create_connection
    sock.connect(sa)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
KeyboardInterrupt

SAWS bombing on start? Error `ValueError: unknown locale: UTF-8`

Hi!

Just following the instructions to install and run the tool.

I've just done sudo pip install saws and the install apparently runs fine. The last line of the pip output reads:

Successfully installed awscli-1.8.7 botocore-1.2.5 click-5.1 colorama-0.3.3 configobj-5.0.6 docutils-0.12 enum34-1.0.4 fuzzyfinder-1.0.0 jmespath-0.8.0 ordereddict-1.1 prompt-toolkit-0.50 python-dateutil-2.4.2 rsa-3.2 saws-0.2.1 wcwidth-0.1.5

But when running saws I get:

jjarava$ saws
Traceback (most recent call last):
  File "/usr/local/bin/saws", line 9, in <module>
    load_entry_point('saws==0.2.1', 'console_scripts', 'saws')()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Python/2.7/site-packages/saws/main.py", line 20, in <module>
    from .saws import Saws
  File "/Library/Python/2.7/site-packages/saws/saws.py", line 31, in <module>
    from awscli import completer as awscli_completer
  File "/Library/Python/2.7/site-packages/awscli/completer.py", line 12, in <module>
    import awscli.clidriver
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 30, in <module>
    from awscli.help import ProviderHelpCommand
  File "/Library/Python/2.7/site-packages/awscli/help.py", line 19, in <module>
    from docutils.core import publish_string
  File "/Library/Python/2.7/site-packages/docutils/core.py", line 20, in <module>
    from docutils import frontend, io, utils, readers, writers
  File "/Library/Python/2.7/site-packages/docutils/frontend.py", line 41, in <module>
    import docutils.utils
  File "/Library/Python/2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
    import docutils.io
  File "/Library/Python/2.7/site-packages/docutils/io.py", line 18, in <module>
    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
  File "/Library/Python/2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
    locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 511, in getdefaultlocale
    return _parse_localename(localename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 443, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

Any clues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.