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

Remove line wraps for the help usage #298

Closed
mbkupfer opened this issue Dec 19, 2018 · 25 comments
Closed

Remove line wraps for the help usage #298

mbkupfer opened this issue Dec 19, 2018 · 25 comments
Milestone

Comments

@mbkupfer
Copy link

Is your feature request related to a problem? Please describe.
Help text is very hard to read since the long lines are wrapping the terminal. I always need to expand my terminal to get rid of the linewrap.

Describe the solution you'd like
A column like help text. Instead of the lines wrapping to the beginning of the terminal, we can instead have them break in their own column.

Additional context
image
image

@abraunegg
Copy link
Owner

@mbkupfer
You can also use the man page:

man onedrive

How does that get formatted in the 'default' terminal window?

@mbkupfer
Copy link
Author

mbkupfer commented Dec 19, 2018

@abraunegg

You can also use the man page:
man onedrive
How does that get formatted in the 'default' terminal window?

Look's great. Why don't you just add this to the usage text instead of --help?

@abraunegg
Copy link
Owner

Look's great. Why don't you just add this to the usage text instead of --help?

The formatting of the --help is based on the D language functions used to handle input options & output. Will investigate to see if this can be 'fixed', however in a SSH session via putty or other, it does not line wrap, so this issue is more of a 'default terminal options' item for your Linux install which is causing the lines to line wrap.

@mbkupfer
Copy link
Author

mbkupfer commented Dec 19, 2018 via email

@norbusan
Copy link
Collaborator

What about the following output?

Usage: onedrive [OPTION]...

no option        No sync and exit

Options:
  --check-for-nomount 
    Check for the presence of .nosync in the syncdir root. If found, do not perform sync.
  --confdir 
    Set the directory used to store the configuration files
  --create-directory 
    Create a directory on OneDrive - no sync will be performed.
  --destination-directory 
    Destination directory for renamed or move on OneDrive - no sync will be performed.
  --debug-https 
    Debug OneDrive HTTPS communication.
  --disable-notifications 
    Do not use desktop notifications in monitor mode.
  --display-config 
    Display what options the client will use as currently configured - no sync will be performed.
  --download-only -d
    Only download remote changes
  --disable-upload-validation 
    Disable upload validation when uploading to OneDrive
  --enable-logging 
    Enable client activity to a separate log file
  --get-O365-drive-id 
    Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library
  --local-first 
    Synchronize from the local directory source first, before downloading changes from OneDrive.
  --logout 
    Logout the current user
  --monitor -m
    Keep monitoring for local and remote changes
  --no-remote-delete 
    Do not delete local file 'deletes' from OneDrive when using --upload-only
  --print-token 
    Print the access token, useful for debugging
  --resync 
    Forget the last saved state, perform a full sync
  --remove-directory 
    Remove a directory on OneDrive - no sync will be performed.
  --single-directory 
    Specify a single local directory within the OneDrive root to sync.
  --skip-symlinks 
    Skip syncing of symlinks
  --source-directory 
    Source directory to rename or move on OneDrive - no sync will be performed.
  --syncdir 
    Set the directory used to sync the files that are synced
  --synchronize 
    Perform a synchronization
  --upload-only 
    Only upload to OneDrive, do not sync changes from OneDrive locally
  --verbose -v+
    Print more details, useful for debugging (repeat for extra debugging)
  --version 
    Print the version and exit
  --help -h
    This help information.

@mbkupfer
Copy link
Author

mbkupfer commented Dec 20, 2018

@norbusan , this looks much better.

Here are some suggestions:

  1. Add a brief description of the tool between Usage: onedrive [OPTION]... and Options. You could even include the no option No sync and exit part in that description. More importantly though, I think this description should explain the synchronize argument and it's mutual exclusivity w/the monitor argument.

  2. Adding annotations for the options that require values. For example:
    --confdir [dir_name]

I don't write many cli's so I don't know the main convention, but I hope you understand my example.

@norbusan
Copy link
Collaborator

norbusan commented Dec 20, 2018

Hi @mbkupfer

Yeah, it was only a first shot without much work necessary.

Adding the information about arguments and their types is a bit a pain due to the D getopt interface, but I'm looking into it.

Concerning the initial description, any suggestion ;-) ?

@mbkupfer
Copy link
Author

mbkupfer commented Dec 20, 2018

Adding the information about arguments and their types is a bit a pain due to the D getopt interface, but I'm looking into it.

Wish I could help there, but I didn't even know about the D language until I got to this project.

Concerning the initial description, any suggestion ;-) ?

I'm still learning how onedrive works myself. I don't think I would be a definitive source ☹️ Happy to copy-edit though.

@adudek
Copy link

adudek commented Dec 20, 2018

@norbusan Might I recommend using http://docopt.org/ for this purpose. It does exacly what you need but in reverse. First you specify formatted docopt usage message, and then logic does parameter validation and conversion. Aaaaand it implemented in almost every language now

@norbusan
Copy link
Collaborator

norbusan commented Dec 20, 2018

@adudek thanks, I'll look into that, but for now i don't want to go into using dup, so I think we would need to copy the source code.

@norbusan
Copy link
Collaborator

norbusan commented Dec 20, 2018

I have implemented the command line parsing via docopt.d The current status is as follows (see branch https://github.com/abraunegg/onedrive/tree/norbert/betterHelpFormat):

No argument given, or wrong argument given, or error:

$ ./onedrive 
Usage:
  onedrive [options] [-v | -vv] (--synchronize | --monitor)
  onedrive --display-config
  onedrive -h | --help
  onedrive --version

Help given:

$ ./onedrive -h
OneDrive - a complete tool to interact with OneDrive on Linux

Usage:
  onedrive [options] [-v | -vv] (--synchronize | --monitor)
  onedrive --display-config
  onedrive -h | --help
  onedrive --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --check-for-nomount     
       Check for the presence of .nosync in the syncdir root. If found, do not perform sync.
  --confdir ARG
       Set the directory used to store the configuration files
       [default: /home/norbert/.config/onedrive]
  --create-directory ARG
       Create a directory on OneDrive - no sync will be performed.
  --destination-directory ARG
       Destination directory for renamed or move on OneDrive - no sync will be performed.
  --debug-https
       Debug OneDrive HTTPS communication.
  --disable-notifications 
       Do not use desktop notifications in monitor mode.
  --display-config 
       Display what options the client will use as currently configured - no sync will be performed.
  --download-only -d
       Only download remote changes
  --disable-upload-validation 
       Disable upload validation when uploading to OneDrive
  --enable-logging 
       Enable client activity to a separate log file
  --get-O365-drive-id ARG
       Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library
  --local-first 
       Synchronize from the local directory source first, before downloading changes from OneDrive.
  --logout 
       Logout the current user
  --monitor -m
       Keep monitoring for local and remote changes
  --no-remote-delete 
       Do not delete local file 'deletes' from OneDrive when using --upload-only
  --print-token 
       Print the access token, useful for debugging
  --resync 
       Forget the last saved state, perform a full sync
  --remove-directory ARG
       Remove a directory on OneDrive - no sync will be performed.
  --single-directory 
       Specify a single local directory within the OneDrive root to sync.
  --skip-symlinks 
       Skip syncing of symlinks
  --source-directory ARG
       Source directory to rename or move on OneDrive - no sync will be performed.
  --syncdir ARG
       Set the directory used to sync the files that are synced
  --synchronize 
       Perform a synchronization
  --upload-only 
       Only upload to OneDrive, do not sync changes from OneDrive locally
  --verbose -v
       Print more details, useful for debugging (repeat for extra debugging)

Let me know what you think?

@abraunegg
Copy link
Owner

abraunegg commented Dec 20, 2018

LGTM

--single-directory

needs a slight tweak:

--single-directory ARG

@mbkupfer
Copy link
Author

First off, great work! I think this looks much better.

Below are some comments I have. Please don't take this as me being critical, I'm simply giving the honest opinion of someone that is new to this tool and want's to figure out how it works. I think it is really easy to shoot yourself in the foot by getting into a state where you delete files from the cloud without any backup.

Comments:

  • Do all arguments have to be wrapped in ' ' 's? If so, then I'd add that just to avoid confusion.

  • In --confdir ARG: I'd replace /home/norbert with ~/

  • Wording seems vague for --destination-directory ARG. I can't really tell what it does. On first look, it appears that it is setting the sync_dir which I don't think it does.

  • Same thing w/wording on --source-directory ARG. How does this work? Do I put the name of a directory that I locally changed or moved and it will then update in the cloud?

  • Also not sure what --syncdir ARG does from its description.

  • slight tweak to --synchronize: Perform a synchronization. Syncs all files in OneDrive when no argument is provided.

@norbusan
Copy link
Collaborator

--single-directory ARG

Thanks, fixed

@norbusan
Copy link
Collaborator

* Do all arguments have to be wrapped in `' '` 's? If so, then I'd add that just to avoid confusion.

what do you mean? None of them are? Please look at it on github, not in the email. This is markdown for the purpose of formatting.

* In `--confdir ARG`: I'd replace `/home/norbert` with `~/`

It is replaced with the correct value for the user invoking the program.

* Wording seems vague for  `--destination-directory ARG`. I can't really tell what it does. On first look, it appears that it is setting the `sync_dir` which I don't think it does.

For now I just used the help strings as they have been till now.

* slight tweak to `--synchronize`: Perform a synchronization. Syncs all files in OneDrive when no argument is provided.

I leave wording improvements to @abraunegg - I'm not native and might scramble down stupid things ;-)

@mbkupfer
Copy link
Author

what do you mean? None of them are? Please look at it on github, not in the email. This is markdown for the purpose of formatting.

What I mean is that arguments have to be surrounded by single-quotes. For example, if I want to do a --single-directory with folder foo, then I have to enter it as such:
onedrive --synchronize --single-directory 'foo' @abraunegg , am I correct in understanding this?

It is replaced with the correct value for the user invoking the program.
Sounds good.

@abraunegg
Copy link
Owner

What I mean is that arguments have to be surrounded by single-quotes. For example, if I want to do a --single-directory with folder foo, then I have to enter it as such:
onedrive --synchronize --single-directory 'foo' @abraunegg , am I correct in understanding this?

Generally it is better to put single quotes around items as per onedrive --synchronize --single-directory 'foo' so that 'spaces in the item' get read in correctly without issue by the application.

@mbkupfer
Copy link
Author

mbkupfer commented Dec 21, 2018 via email

@norbusan
Copy link
Collaborator

Ahh, this one. That is basic property of parsing by the used shell, and nothing related to onedrive.

@mbkupfer
Copy link
Author

@norbusan @abraunegg , is this issue closed?

@norbusan
Copy link
Collaborator

@mbkupfer No, this is a pull request but it is not decided whether - and if when - we integrate it. We first have to fix some bugs and clean up some stuff before moving forward with this. Very similar to the build system reworks, this is also on lower priority.

Thanks for your understanding

@abraunegg
Copy link
Owner

@norbusan
Let's get this resolved for v2.2.4

@abraunegg abraunegg added this to the 2.2.4 milestone Dec 28, 2018
@norbusan
Copy link
Collaborator

norbusan commented Dec 28, 2018

After merging the display-sync-status stuff I'll rework the patch and hello text to for current status.

norbusan added a commit that referenced this issue Dec 28, 2018
Instead of using the auto-generated help message from getopt,
use docopt style help message and use the docopt command line
parser.
@norbusan
Copy link
Collaborator

Fixed with recent merge

@lock
Copy link

lock bot commented Jan 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Jan 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants