Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure command tree / refactor repo layout #119

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -18,5 +18,5 @@ script:
# crash and burn catastrophically
- globus --help # parsing failures
- globus list-commands # actually running a command
- globus auth get-identities 'abc@globus.org' --map-http-status "401=0" # auth call (noauth)
- globus transfer ls 'ddb59aef-6d04-11e5-ba46-22000b92c6ec' --map-http-status "400=0" # transfer call (noauth)
- globus get-identities 'abc@globus.org' --map-http-status "401=0" # auth call (noauth)
- globus ls 'ddb59aef-6d04-11e5-ba46-22000b92c6ec' --map-http-status "400=0" # transfer call (noauth)
2 changes: 1 addition & 1 deletion globus_cli/__init__.py
@@ -1,4 +1,4 @@
from globus_cli.run import main
from globus_cli.commands import main
from globus_cli.version import __version__


Expand Down
3 changes: 3 additions & 0 deletions globus_cli/commands/__init__.py
@@ -0,0 +1,3 @@
from globus_cli.commands.main import main

__all__ = ['main']
3 changes: 3 additions & 0 deletions globus_cli/commands/bookmark/__init__.py
@@ -0,0 +1,3 @@
from globus_cli.commands.bookmark.commands import bookmark_command

__all__ = ['bookmark_command']
Expand Up @@ -2,12 +2,12 @@

from globus_cli.parsing import common_options

from globus_cli.services.transfer.bookmark.list import bookmark_list
from globus_cli.services.transfer.bookmark.create import bookmark_create
from globus_cli.services.transfer.bookmark.delete import bookmark_delete
from globus_cli.services.transfer.bookmark.rename import bookmark_rename
from globus_cli.services.transfer.bookmark.show import bookmark_show
from globus_cli.services.transfer.bookmark.locate import bookmark_locate
from globus_cli.commands.bookmark.list import bookmark_list
from globus_cli.commands.bookmark.create import bookmark_create
from globus_cli.commands.bookmark.delete import bookmark_delete
from globus_cli.commands.bookmark.rename import bookmark_rename
from globus_cli.commands.bookmark.show import bookmark_show
from globus_cli.commands.bookmark.locate import bookmark_locate


@click.group(name='bookmark', help='Manage Endpoint Bookmarks')
Expand Down
Expand Up @@ -4,7 +4,7 @@
from globus_cli.parsing import common_options, ENDPOINT_PLUS_REQPATH
from globus_cli.helpers import outformat_is_json, print_json_response

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer import get_client


@click.command('create', help='Create a Bookmark for the current user')
Expand All @@ -14,7 +14,7 @@
@click.argument('bookmark_name')
def bookmark_create(endpoint_plus_path, bookmark_name):
"""
Executor for `globus transfer bookmark create`
Executor for `globus bookmark create`
"""
endpoint_id, path = endpoint_plus_path
client = get_client()
Expand Down
Expand Up @@ -4,15 +4,15 @@
from globus_cli.parsing import common_options
from globus_cli.helpers import outformat_is_json, print_json_response

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer import get_client


@click.command('delete', help='Delete a Bookmark')
@common_options
@click.argument('bookmark_id')
def bookmark_delete(bookmark_id):
"""
Executor for `globus transfer bookmark delete`
Executor for `globus bookmark delete`
"""
client = get_client()

Expand Down
Expand Up @@ -3,15 +3,15 @@
from globus_cli.parsing import common_options
from globus_cli.helpers import outformat_is_json, print_table

from globus_cli.services.transfer.helpers import (
from globus_cli.services.transfer import (
print_json_from_iterator, get_client)


@click.command('list', help='List Bookmarks for the current user')
@common_options
def bookmark_list():
"""
Executor for `globus transfer bookmark list`
Executor for `globus bookmark list`
"""
client = get_client()

Expand Down
@@ -1,8 +1,8 @@
import click

from globus_cli.parsing import common_options
from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer.bookmark.helpers import resolve_id_or_name
from globus_cli.services.transfer import get_client
from globus_cli.commands.bookmark.helpers import resolve_id_or_name


@click.command('locate', help=('Output <UUID>:<path> of a bookmark; useful in '
Expand All @@ -12,7 +12,7 @@
@click.argument('bookmark_id_or_name')
def bookmark_locate(bookmark_id_or_name):
"""
Executor for `globus transfer bookmark locate`
Executor for `globus bookmark locate`
"""
client = get_client()
res = resolve_id_or_name(client, bookmark_id_or_name)
Expand Down
Expand Up @@ -4,7 +4,7 @@
from globus_cli.parsing import common_options
from globus_cli.helpers import outformat_is_json, print_json_response

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer import get_client


@click.command('rename', help='Change a Bookmark\'s name')
Expand All @@ -13,7 +13,7 @@
@click.argument('new_bookmark_name')
def bookmark_rename(bookmark_id, new_bookmark_name):
"""
Executor for `globus transfer bookmark rename`
Executor for `globus bookmark rename`
"""
client = get_client()

Expand Down
Expand Up @@ -4,16 +4,16 @@
from globus_cli.helpers import (
outformat_is_json, print_json_response, colon_formatted_print)

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer.bookmark.helpers import resolve_id_or_name
from globus_cli.services.transfer import get_client
from globus_cli.commands.bookmark.helpers import resolve_id_or_name


@click.command('show', help='Show a Bookmark by either name or ID')
@common_options
@click.argument('bookmark_id_or_name')
def bookmark_show(bookmark_id_or_name):
"""
Executor for `globus transfer bookmark show`
Executor for `globus bookmark show`
"""
client = get_client()
res = resolve_id_or_name(client, bookmark_id_or_name)
Expand Down
5 changes: 5 additions & 0 deletions globus_cli/commands/config/__init__.py
@@ -0,0 +1,5 @@
from globus_cli.commands.config.commands import config_command

__all__ = [
'config_command'
]
Expand Up @@ -2,11 +2,11 @@

from globus_cli.parsing import common_options

from globus_cli.config_command.edit import edit_command
from globus_cli.config_command.init import init_command
from globus_cli.config_command.remove import remove_command
from globus_cli.config_command.set import set_command
from globus_cli.config_command.show import show_command
from globus_cli.commands.config.edit import edit_command
from globus_cli.commands.config.init import init_command
from globus_cli.commands.config.remove import remove_command
from globus_cli.commands.config.set import set_command
from globus_cli.commands.config.show import show_command


@click.group('config', short_help=(
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -2,8 +2,7 @@

from globus_cli.safeio import safeprint
from globus_cli.parsing import common_options

from globus_cli.config_command.helpers import load_config
from globus_cli.config import get_config_obj


@click.command('remove', help='Remove a value from the Globus Config')
Expand All @@ -13,7 +12,7 @@ def remove_command(parameter):
"""
Executor for `globus config remove`
"""
conf = load_config()
conf = get_config_obj()

section = 'general'
if '.' in parameter:
Expand Down
Expand Up @@ -2,8 +2,7 @@

from globus_cli.safeio import safeprint
from globus_cli.parsing import common_options

from globus_cli.config_command.helpers import load_config
from globus_cli.config import get_config_obj


@click.command('set', help='Set a value in the Globus Config')
Expand All @@ -14,7 +13,7 @@ def set_command(value, parameter):
"""
Executor for `globus config set`
"""
conf = load_config()
conf = get_config_obj()

section = 'general'
if '.' in parameter:
Expand Down
File renamed without changes.
Expand Up @@ -5,17 +5,16 @@


from globus_cli.parsing import (
common_options, submission_id_option, TaskPath, ENDPOINT_PLUS_OPTPATH)
common_options, submission_id_option, TaskPath, ENDPOINT_PLUS_OPTPATH,
shlex_process_stdin)
from globus_cli.safeio import safeprint
from globus_cli.helpers import (
outformat_is_json, print_json_response, colon_formatted_print)

from globus_cli.services.transfer.helpers import (
get_client, shlex_process_stdin)
from globus_cli.services.transfer.activation import autoactivate
from globus_cli.services.transfer import get_client, autoactivate


@click.command('async-delete', short_help='Submit a Delete Task',
@click.command('delete', short_help='Submit a Delete Task',
help=('Delete a file or directory from one Endpoint as an '
'asynchronous task.'))
@common_options
Expand All @@ -34,15 +33,15 @@
'a prefix to all paths given'))
@click.argument('endpoint_plus_path', metavar=ENDPOINT_PLUS_OPTPATH.metavar,
type=ENDPOINT_PLUS_OPTPATH)
def async_delete_command(batch, ignore_missing, recursive, endpoint_plus_path,
label, submission_id, dry_run):
def delete_command(batch, ignore_missing, recursive, endpoint_plus_path,
label, submission_id, dry_run):
"""
Executor for `globus transfer async-delete`
Executor for `globus delete`
"""
endpoint_id, path = endpoint_plus_path
if path is None and (not batch):
raise click.UsageError(
'async-delete requires either a PATH OR --batch')
'delete requires either a PATH OR --batch')

client = get_client()
autoactivate(client, endpoint_id, if_expires_in=60)
Expand All @@ -53,7 +52,7 @@ def async_delete_command(batch, ignore_missing, recursive, endpoint_plus_path,
ignore_missing=ignore_missing)

if batch:
# although this sophisticated structure (like that in async-transfer)
# although this sophisticated structure (like that in transfer)
# isn't strictly necessary, it gives us the ability to add options in
# the future to these lines with trivial modifications
@click.command()
Expand Down
4 changes: 4 additions & 0 deletions globus_cli/commands/endpoint/__init__.py
@@ -0,0 +1,4 @@
from globus_cli.commands.endpoint.commands import endpoint_command


__all__ = ['endpoint_command']
43 changes: 43 additions & 0 deletions globus_cli/commands/endpoint/commands.py
@@ -0,0 +1,43 @@
import click

from globus_cli.parsing import common_options

from globus_cli.commands.endpoint.permission import permission_command
from globus_cli.commands.endpoint.role import role_command
from globus_cli.commands.endpoint.server import server_command

from globus_cli.commands.endpoint.search import endpoint_search
from globus_cli.commands.endpoint.show import endpoint_show
from globus_cli.commands.endpoint.create import endpoint_create
from globus_cli.commands.endpoint.update import endpoint_update
from globus_cli.commands.endpoint.delete import endpoint_delete
from globus_cli.commands.endpoint.share import endpoint_create_share
from globus_cli.commands.endpoint.is_activated import endpoint_is_activated
from globus_cli.commands.endpoint.deactivate import endpoint_deactivate
from globus_cli.commands.endpoint.my_shared_endpoint_list import (
my_shared_endpoint_list)


@click.group(name='endpoint', help='Manage Globus Endpoint definitions')
@common_options
def endpoint_command():
pass


# groups
endpoint_command.add_command(permission_command)
endpoint_command.add_command(role_command)
endpoint_command.add_command(server_command)

# commands
endpoint_command.add_command(endpoint_search)
endpoint_command.add_command(endpoint_show)
endpoint_command.add_command(endpoint_create)
endpoint_command.add_command(endpoint_create_share)
endpoint_command.add_command(endpoint_update)
endpoint_command.add_command(endpoint_delete)

endpoint_command.add_command(endpoint_is_activated)
endpoint_command.add_command(endpoint_deactivate)

endpoint_command.add_command(my_shared_endpoint_list)
Expand Up @@ -4,8 +4,7 @@
common_options, endpoint_create_and_update_params)
from globus_cli.helpers import print_json_response

from globus_cli.services.transfer.helpers import (
get_client, assemble_generic_doc)
from globus_cli.services.transfer import get_client, assemble_generic_doc


@click.command('create', help='Create a new Endpoint')
Expand All @@ -21,7 +20,7 @@ def endpoint_create(endpoint_type, display_name, description, organization,
default_directory, force_encryption, oauth_server,
myproxy_server, myproxy_dn):
"""
Executor for `globus transfer endpoint create`
Executor for `globus endpoint create`
"""
ep_doc = assemble_generic_doc(
'endpoint',
Expand Down
Expand Up @@ -3,15 +3,15 @@
from globus_cli.parsing import common_options, endpoint_id_arg
from globus_cli.helpers import print_json_response

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer import get_client


@click.command('deactivate', help='Deactivate an Endpoint')
@common_options
@endpoint_id_arg
def endpoint_deactivate(endpoint_id):
"""
Executor for `globus transfer endpoint deactivate`
Executor for `globus endpoint deactivate`
"""
client = get_client()
res = client.endpoint_deactivate(endpoint_id)
Expand Down
Expand Up @@ -4,15 +4,15 @@
from globus_cli.parsing import common_options, endpoint_id_arg
from globus_cli.helpers import outformat_is_json, print_json_response

from globus_cli.services.transfer.helpers import get_client
from globus_cli.services.transfer import get_client


@click.command('delete', help='Delete a given Endpoint')
@common_options
@endpoint_id_arg
def endpoint_delete(endpoint_id):
"""
Executor for `globus transfer endpoint delete`
Executor for `globus endpoint delete`
"""
client = get_client()

Expand Down