Skip to content

Commit

Permalink
Improve grammar of the messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Beiner authored and Maxbey committed Jun 5, 2017
1 parent 8eb4f81 commit 07e7411
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ignore-paths:
- build
- tests
- termius/core/utils.py # it's too complex
- termius/core/commands/help.py # it's too complex


ignore-patterns:
- (^|/)(?!termius)?(/|$)
Expand All @@ -17,6 +19,7 @@ pep257:
disable:
- D203 # 1 blank line required before
- D213
- D400

pylint:
options:
Expand Down
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mock
nose
coverage
prospector[with_pyroma]
prospector[with_pyroma]==0.12.4
pylint==1.6.5
pyroma==2.0
paver
bumpversion
Expand Down
14 changes: 7 additions & 7 deletions termius/account/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def __init__(self, app, app_args, cmd_name=None):


class LoginCommand(BaseAccountCommand):
"""sign into Termius Cloud"""
"""sign into the Termius Cloud"""

# pylint: disable=no-self-use
def prompt_username(self):
"""Ask username prompt."""
return six.moves.input("Username: ")
return six.moves.input('Username: ')

# pylint: disable=no-self-use
def prompt_authy_token(self):
Expand All @@ -53,7 +53,7 @@ def take_action(self, parsed_args):


class LogoutCommand(BaseAccountCommand):
"""sign out Termius Cloud"""
"""sign out of the Termius Cloud"""

def take_action(self, _):
"""Process CLI call."""
Expand All @@ -63,19 +63,19 @@ def take_action(self, _):


class SettingsCommand(BaseAccountCommand):
"""update account settings"""
"""update the account settings"""

def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument(
'--synchronize-key', action='store', type=boolean_yes_no,
choices=(False, True), default=True,
help='Sync ssh keys and ssh identities or not.'
help='enable/disable ssh keys and identities sync'
)
parser.add_argument(
'--agent-forwarding', action='store', type=boolean_yes_no,
choices=(False, True), default=True,
help='Sync ssh keys and ssh identities or not.'
help='enable/disable agent forwarding'
)
return parser

Expand All @@ -86,7 +86,7 @@ def take_action(self, args):
for k in ('synchronize_key', 'agent_forwarding')
}
self.manager.set_settings(settings)
self.log.info('Set settings.')
self.log.info('Settings updated')


@contextmanager
Expand Down
6 changes: 3 additions & 3 deletions termius/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def build_option_parser(self, description, version,
action='store_const',
dest='verbose_level',
const=0,
help='only display warnings and errors',
help='display warnings and errors only',
)
parser.add_argument(
'--log-file',
action='store',
default=None,
help='record output in a designated file',
help='record output into a designated file',
)
if self.deferred_help:
parser.add_argument(
Expand All @@ -134,7 +134,7 @@ def build_option_parser(self, description, version,
action=HelpAction,
nargs=0,
default=self, # tricky
help="display help message",
help="show the help message",
)
parser.add_argument(
'--debug',
Expand Down
6 changes: 3 additions & 3 deletions termius/cloud/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def validate_password(self, password):


class PushCommand(CloudSynchronizationCommand):
"""push data to Termius Cloud"""
"""push data to the Termius Cloud"""

get_strategy = RelatedGetStrategy
save_strategy = SyncSaveStrategy
Expand All @@ -66,7 +66,7 @@ def process_sync(self, api_controller):


class PullCommand(CloudSynchronizationCommand):
"""pull data from Termius Cloud"""
"""pull data from the Termius Cloud"""

save_strategy = SyncSaveStrategy

Expand All @@ -78,7 +78,7 @@ def process_sync(self, api_controller):


class FullCleanCommand(CloudSynchronizationCommand):
"""remove user data from Termius Cloud"""
"""remove user data from the Termius Cloud"""

get_strategy = RelatedGetStrategy
save_strategy = SyncSaveStrategy
Expand Down
2 changes: 1 addition & 1 deletion termius/core/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_parser(self, prog_name):
"""Create command line argument parser."""
parser = super(AbstractCommand, self).get_parser(prog_name)
parser.add_argument(
'--log-file', help='record output in a designated file'
'--log-file', help='record output to FILE'
)
return self.extend_parser(parser)

Expand Down
2 changes: 1 addition & 1 deletion termius/core/commands/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __call__(self, parser, namespace, values, option_string=None):


class HelpCommand(BaseHelpCommand):
"""display command specific help message"""
"""display the command specific help message"""

def take_action(self, parsed_args):
if parsed_args.cmd:
Expand Down
4 changes: 2 additions & 2 deletions termius/core/commands/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def get_relation(self, model_class, arg):
def fail_not_exist(self, model_class):
"""Raise an error about not existed instance."""
raise ArgumentRequiredException(
'Not found any {} instance.'.format(model_class)
'Not found any {} instance.'.format(model_class.__name__.lower())
)

# pylint: disable=no-self-use
def fail_too_many(self, model_class):
"""Raise an error about too many instances."""
raise ArgumentRequiredException(
'Found too many {} instances.'.format(model_class)
'Found too many {} instances.'.format(model_class.__name__.lower())
)

def get_safely_instance(self, model_class, arg):
Expand Down
4 changes: 2 additions & 2 deletions termius/core/commands/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def get_parser(self, prog_name):
)
parser.add_argument(
'-L', '--label', metavar='NAME',
help="entry label"
help="name or rename the entry label NAME"
)
parser.add_argument(
'entry', nargs='*', metavar='ID or NAME',
help='pass to edit existed entries'
help='select the entry with ID or NAME'
)
return parser

Expand Down
8 changes: 4 additions & 4 deletions termius/handlers/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class ConnectCommand(SshCommandFormatterMixin, SshConfigMergerMixin,
GetRelationMixin, AbstractCommand):
"""connect to specific host"""
"""connect to a specific host with NAME or ID"""

get_strategy = RelatedGetStrategy

Expand All @@ -20,16 +20,16 @@ def extend_parser(self, parser):
parser.add_argument(
'-H', '--host', const=Host,
dest='model', action='store_const', default=Host,
help='connect to host or start portforwarding rule'
help='connect to a host'
)
parser.add_argument(
'-R', '--pfrule', const=PFRule,
dest='model', action='store_const', default=Host,
help='connect to host or start portforwarding rule'
help='connect to a host using a port forwarding rule'
)
parser.add_argument(
'entry', metavar='ID or NAME',
help='connect to host or start portforwarding rule'
help='connect to the specific host'
)
return parser

Expand Down
9 changes: 5 additions & 4 deletions termius/handlers/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class GroupCommand(GroupStackGetterMixin, DetailCommand):
"""operate with group object"""
"""work with a group"""

model_class = Group

Expand All @@ -37,7 +37,8 @@ def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument(
'-g', '--parent-group',
metavar='PARENT_GROUP', help="parent group id or name"
metavar='PARENT_GROUP',
help='select the parent group with ID or NAME'
)
self.ssh_config_args.add_agrs(parser)
return parser
Expand All @@ -63,7 +64,7 @@ def serialize_args(self, args, instance=None):


class GroupsCommand(SshConfigPrepareMixin, ListCommand):
"""list group objects"""
"""list all groups"""

model_class = Group
get_strategy = RelatedGetStrategy
Expand All @@ -77,7 +78,7 @@ def extend_parser(self, parser):
)
parser.add_argument(
'group', nargs='?', metavar='GROUP_ID or GROUP_NAME',
help='list groups in this group'
help='list groups in the group with ID or NAME'
)
return parser

Expand Down
21 changes: 11 additions & 10 deletions termius/handlers/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class HostCommand(DetailCommand):
"""operate with host object"""
"""work with a host"""

model_class = Host
required_options = RequiredOptions(create=('address',))
Expand All @@ -35,13 +35,13 @@ def __init__(self, app, app_args, cmd_name=None):
def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument(
'-t', '--tag', metavar='TAG_NAME',
'-t', '--tag', metavar='TAG',
action='append', default=[], dest='tags',
help='specify the tag(s) for host, can be repeated'
help='specify the TAG(s) for a host (can be repeated)'
)
parser.add_argument(
'-g', '--group', metavar='GROUP_ID or GROUP_NAME',
help='move hosts to this group'
'-g', '--group', metavar='ID or NAME',
help='move the host to the group with ID or NAME'
)
parser.add_argument(
'-a', '--address',
Expand Down Expand Up @@ -76,7 +76,7 @@ def serialize_args(self, args, instance=None):


class HostsCommand(GroupStackGetterMixin, ListCommand):
"""list host objects"""
"""list all hosts"""

model_class = Host
get_strategy = RelatedGetStrategy
Expand All @@ -89,13 +89,14 @@ def __init__(self, app, app_args, cmd_name=None):
def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument(
'-t', '--tag', metavar='TAG_NAME',
'-t', '--tag', metavar='TAG',
action='append', default=[], dest='tags',
help='specify the tag(s) for host, can be repeated'
help='specify the TAG(s) for a host (can be repeated)'
)
parser.add_argument(
'-g', '--group', metavar='GROUP_ID or GROUP_NAME',
help=('list hosts in group (current group by default)')
'-g', '--group', metavar='ID or NAME',
help=('list hosts in the group with ID or NAME'
'(current group by default)')
)
return parser

Expand Down
12 changes: 6 additions & 6 deletions termius/handlers/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class IdentityCommand(SshKeyGeneratorMixin, DetailCommand):
"""operate with identity object"""
"""work with an identity"""

model_class = Identity

Expand Down Expand Up @@ -42,19 +42,19 @@ def extend_parser(self, parser):
"""Add more arguments to parser."""
parser.add_argument(
'-u', '--username',
metavar='USERNAME', help="username for SSH authorization"
metavar='USERNAME', help='username for ssh authentication'
)
parser.add_argument(
'-p', '--password',
metavar='PASSWORD', help="password for SSH authorization"
metavar='PASSWORD', help='password for ssh authentication'
)
parser.add_argument(
'-i', '--identity-file',
metavar='PRIVATE_KEY', help='private key'
metavar='FILE', help='select FILE as private key'
)
parser.add_argument(
'-k', '--ssh-key',
metavar='SSH_KEY', help="ssh key name or id"
metavar='ID or NAME', help='define ssh key with ID or NAME'
)
return parser

Expand All @@ -71,7 +71,7 @@ def get_objects(self, ids__names):


class IdentitiesCommand(ListCommand):
"""list identity objects"""
"""list all identities"""

model_class = Identity

Expand Down
8 changes: 6 additions & 2 deletions termius/handlers/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class InfoCommand(SshConfigMergerMixin, GetRelationMixin,
ShowOne, AbstractCommand):
"""display info about host or group"""
"""display info about a host or group"""

get_strategy = RelatedGetStrategy
model_class = SshConfig
Expand All @@ -38,7 +38,11 @@ def extend_parser(self, parser):
'-M', '--no-merge', action='store_true',
help='do not merge configs'
)
parser.add_argument('id_or_name', metavar='ID or NAME')
parser.add_argument(
'id_or_name',
metavar='ID or NAME',
help='display information about the group or host with ID'
)
return parser

# pylint: disable=unused-argument
Expand Down
2 changes: 1 addition & 1 deletion termius/handlers/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class InitCommand(AbstractCommand):
"""initialize Termius CLI"""
"""initialize the Termius CLI"""

# pylint: disable=no-self-use
def prompt_username(self):
Expand Down
Loading

0 comments on commit 07e7411

Please sign in to comment.