Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions cbrain_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def main():
"--data-provider", type=int, required=True, help="Data provider ID"
)
file_upload_parser.add_argument("--group-id", type=int, help="Group ID")
file_upload_parser.add_argument("--file-type", type=str, default="SingleFile", help="File type (default: SingleFile)")

file_upload_parser.set_defaults(func=handle_errors(handle_file_upload))

Expand Down Expand Up @@ -399,23 +400,20 @@ def main():

# MARK: Setup CLI
args = parser.parse_args()
if args.command == "version":
return handle_errors(version_info)(args)

if not args.command:
parser.print_help()
return

parser.print_help(file=sys.stderr)
return 1
# Handle session commands (no authentication needed for login, version, and whoami).
if args.command == "login":
return handle_errors(create_session)(args)
elif args.command == "version":
return handle_errors(version_info)(args)

elif args.command == "whoami":
return handle_errors(whoami_user)(args)

# All other commands require authentication.
if not is_authenticated():
return 1

# Handle authenticated commands.
if args.command == "logout":
return handle_errors(logout_session)(args)
Expand All @@ -433,23 +431,23 @@ def main():
if not hasattr(args, "action") or not args.action:
# Show help for the specific model command.
if args.command == "file":
file_parser.print_help()
file_parser.print_help(file=sys.stderr)
elif args.command == "dataprovider":
dataprovider_parser.print_help()
dataprovider_parser.print_help(file=sys.stderr)
elif args.command == "project":
project_parser.print_help()
project_parser.print_help(file=sys.stderr)
elif args.command == "tool":
tool_parser.print_help()
tool_parser.print_help(file=sys.stderr)
elif args.command == "tool-config":
tool_configs_parser.print_help()
tool_configs_parser.print_help(file=sys.stderr)
elif args.command == "tag":
tag_parser.print_help()
tag_parser.print_help(file=sys.stderr)
elif args.command == "background":
background_parser.print_help()
background_parser.print_help(file=sys.stderr)
elif args.command == "task":
task_parser.print_help()
task_parser.print_help(file=sys.stderr)
elif args.command == "remote-resource":
remote_resource_parser.print_help()
remote_resource_parser.print_help(file=sys.stderr)
return 1
else:
# Execute the function associated with the command.
Expand Down