Repository: iamleot/transferwee (language: python)

Issue:
added display name option to trasfer
## Display Name Option 
 I added the new option for upload operation.   ```-n display name ```
Without display name When you upload a file with  -m option you will see if you open the transfer link  "Untitled transfer" 
```bash `transferee.py  upload -m "it is a message too" hello ```
<img width="317" alt="Screen Shot 2021-12-14 at 16 43 04" src="https://user-images.githubusercontent.com/50212369/146010725-19853d42-174c-4836-aa60-8e89cc6598c7.png">

So I added a new option for the upload operation it is display name [-n]
With display name option   ```bash transferee.py  upload -n "transfered with this display name" -m "it is a message too" hello ``` , You will se the transfer link with display name like that 👍  
<img width="317" alt="Screen Shot 2021-12-14 at 16 44 35" src="https://user-images.githubusercontent.com/50212369/146011291-ed21a7ee-e3cf-4e3e-ae57-e72e15965c10.png">

thanks for the creating this project 🙏🏻


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index b1ea6be..1affc34 100644
--- a/README.md
+++ b/README.md
@@ -38,17 +38,17 @@ Otherwise the link upload will be used.
 
 ```
 % transferwee upload -h
-usage: transferwee upload [-h] [-m message] [-f from] [-t to [to ...]]
-                          file [file ...]
+usage: transferwee upload [-h] [-n display_name] [-m message] [-f from] [-t to [to ...]] file [file ...]
 
 positional arguments:
-  file            files to upload
+  file             files to upload
 
 optional arguments:
-  -h, --help      show this help message and exit
-  -m message      message description for the transfer
-  -f from         sender email
-  -t to [to ...]  recipient emails
+  -h, --help       show this help message and exit
+  -n display_name  display name for the transfer
+  -m message       message description for the transfer
+  -f from          sender email
+  -t to [to ...]   recipient emails
 ```
 
 The following example creates an `hello` text file with just `Hello world!` and
diff --git a/transferwee.py b/transferwee.py
index 0a6da15..c5ce001 100755
--- a/transferwee.py
+++ b/transferwee.py
@@ -171,7 +171,7 @@ def _prepare_session() -> requests.Session:
     return s
 
 
-def _prepare_email_upload(filenames: List[str], message: str,
+def _prepare_email_upload(filenames: List[str], display_name: str, message: str,
                           sender: str, recipients: List[str],
                           session: requests.Session) -> str:
     """Given a list of filenames, message a sender and recipients prepare for
@@ -182,6 +182,7 @@ def _prepare_email_upload(filenames: List[str], message: str,
     j = {
         "files": [_file_name_and_size(f) for f in filenames],
         "from": sender,
+        "display_name": display_name,
         "message": message,
         "recipients": recipients,
         "ui_language": "en",
@@ -208,7 +209,7 @@ def _verify_email_upload(transfer_id: str, session: requests.Session) -> str:
     return r.json()
 
 
-def _prepare_link_upload(filenames: List[str], message: str,
+def _prepare_link_upload(filenames: List[str], display_name: str, message: str,
                          session: requests.Session) -> str:
     """Given a list of filenames and a message prepare for the link upload.
 
@@ -216,6 +217,7 @@ def _prepare_link_upload(filenames: List[str], message: str,
     """
     j = {
         "files": [_file_name_and_size(f) for f in filenames],
+        "display_name": display_name,
         "message": message,
         "ui_language": "en",
     }
@@ -293,11 +295,12 @@ def _finalize_upload(transfer_id: str, session: requests.Session) -> str:
     return r.json()
 
 
-def upload(files: List[str], message: str = '', sender: str = None,
+def upload(files: List[str], display_name: str = '', message: str = '', sender: str = None,
            recipients: List[str] = []) -> str:
     """Given a list of files upload them and return the corresponding URL.
 
     Also accepts optional parameters:
+     - `display_name': name used as a title of the transfer
      - `message': message used as a description of the transfer
      - `sender': email address used to receive an ACK if the upload is
                  successfull. For every download by the recipients an email
@@ -327,11 +330,11 @@ def upload(files: List[str], message: str = '', sender: str = None,
     if sender and recipients:
         # email upload
         transfer_id = \
-            _prepare_email_upload(files, message, sender, recipients, s)['id']
+            _prepare_email_upload(files, display_name, message, sender, recipients, s)['id']
         _verify_email_upload(transfer_id, s)
     else:
         # link upload
-        transfer_id = _prepare_link_upload(files, message, s)['id']
+        transfer_id = _prepare_link_upload(files, display_name, message, s)['id']
 
     for f in files:
         file_id = _prepare_file_upload(transfer_id, f, s)['id']
@@ -361,6 +364,8 @@ def upload(files: List[str], message: str = '', sender: str = None,
 
     # upload subcommand
     up = sp.add_parser('upload', help='upload files')
+    up.add_argument('-n', type=str, default='', metavar='display_name',
+                    help='title for the transfer')
     up.add_argument('-m', type=str, default='', metavar='message',
                     help='message description for the transfer')
     up.add_argument('-f', type=str, metavar='from', help='sender email')
@@ -381,7 +386,7 @@ def upload(files: List[str], message: str = '', sender: str = None,
         exit(0)
 
     if args.action == 'upload':
-        print(upload(args.files, args.m, args.f, args.t))
+        print(upload(args.files, args.n, args.m, args.f, args.t))
         exit(0)
 
     # No action selected, print help message


Test patch:
diff --git a/tests/check.sh b/tests/check.sh
index 70ea429..9329674 100755
--- a/tests/check.sh
+++ b/tests/check.sh
@@ -20,7 +20,7 @@ echo "Creating a test file..."
 echo "Hello world!" > "${testtmpfile}"
 
 echo "Uploading the test file..."
-url=$(${TRANSFERWEE} upload -m 'Just a text file with the mandatory message...' "${testtmpfile}")
+url=$(${TRANSFERWEE} upload -n 'Nice transfer title' -m 'Just a text file with the mandatory message...' "${testtmpfile}")
 echo "test file uploaded as ${url}"
 
 echo "Renaming original test file..."