Skip to content

Commit d21e552

Browse files
Fix code formatting
1 parent be28898 commit d21e552

File tree

7 files changed

+175
-69
lines changed

7 files changed

+175
-69
lines changed

filecloudapi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2024 FileCloud. All Rights Reserved.
2-
from .fcserver import FCServer
3-
from .exceptions import ServerError
42
from .datastructures import EntryType, FileList, FileListEntry
3+
from .exceptions import ServerError
4+
from .fcserver import FCServer
55

66
__ALL__ = [
77
"FCServer",

filecloudapi/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66

77
from filecloudapi.cli import cli
88

9-
10-
if __name__ == '__main__': # pragma: no cover
9+
if __name__ == "__main__": # pragma: no cover
1110
cli() # pylint: disable=no-value-for-parameter

filecloudapi/cli.py

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,80 @@
1616
--server-url: URL of the FileCloud server.
1717
"""
1818

19+
import os
1920
from dataclasses import dataclass
2021
from pathlib import Path
22+
2123
import click
22-
import os
2324

2425
from filecloudapi.fcserver import FCServer
2526

27+
2628
@dataclass
2729
class ServerConfig:
2830
server_url: str
2931
username: str
3032
password: str
3133

32-
@click.option('-s', '--server-url', prompt=True, hide_input=False, help='URL of the FileCloud server')
33-
@click.option('-u', '--username', prompt=True, hide_input=False, help='Username for authentication')
34-
@click.option('-p', '--password', prompt=True, hide_input=True, default=lambda: os.environ.get('FILECLOUD_PASSWORD', ''), help='Password for authentication')
34+
35+
@click.option(
36+
"-s",
37+
"--server-url",
38+
prompt=True,
39+
hide_input=False,
40+
help="URL of the FileCloud server",
41+
)
42+
@click.option(
43+
"-u",
44+
"--username",
45+
prompt=True,
46+
hide_input=False,
47+
help="Username for authentication",
48+
)
49+
@click.option(
50+
"-p",
51+
"--password",
52+
prompt=True,
53+
hide_input=True,
54+
default=lambda: os.environ.get("FILECLOUD_PASSWORD", ""),
55+
help="Password for authentication",
56+
)
3557
@click.group()
3658
@click.pass_context
3759
def cli(ctx, server_url: str, username: str, password: str):
3860
ctx.obj = ServerConfig(server_url, username, password)
3961
pass
4062

63+
4164
def create_fcserver(config: ServerConfig) -> FCServer:
42-
return FCServer(config.server_url, email=None, username=config.username, password=config.password)
65+
return FCServer(
66+
config.server_url,
67+
email=None,
68+
username=config.username,
69+
password=config.password,
70+
)
71+
4372

4473
@cli.command()
45-
@click.option('-l', '--local', type=Path, required=True, help='Path to the local file to be uploaded')
46-
@click.option('-r', '--remote', type=str, required=True, help='Remote path where the file should be uploaded on the FileCloud server')
74+
@click.option(
75+
"-l",
76+
"--local",
77+
type=Path,
78+
required=True,
79+
help="Path to the local file to be uploaded",
80+
)
81+
@click.option(
82+
"-r",
83+
"--remote",
84+
type=str,
85+
required=True,
86+
help="Remote path where the file should be uploaded on the FileCloud server",
87+
)
4788
@click.pass_obj
4889
def upload_file(config: ServerConfig, local: Path, remote: str):
4990
fcserver = create_fcserver(config)
5091
fcserver.upload_file(local, remote)
5192

5293

53-
if __name__ == '__main__': # pragma: no cover
94+
if __name__ == "__main__": # pragma: no cover
5495
cli()

0 commit comments

Comments
 (0)