-
Notifications
You must be signed in to change notification settings - Fork 791
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
refactor_useQCommandLineParser #2135
base: master
Are you sure you want to change the base?
refactor_useQCommandLineParser #2135
Conversation
Could you please satisfy the DCO bot? Also I think those three commits can be squashed together. |
5291a2c
to
3ebdeb2
Compare
I was able to satisfy the "DCO Bot" but I never did a squash on a branch which I already pushed? Can you do a sqashed merge? |
Sure, I can do that. |
@er-vin Following lines in
|
4fc03e5
to
c8f346b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not getting your PR the attention it deserved last week. Was a bit busy. I like where this is going.
No Problem, I saw there are many refactorings/redesigns ongoing. |
632dbc8
to
3fe74a3
Compare
Looking good. I spotted another such hand rolled command line handling in cmd.cpp. Do you fancy porting it as well? If yes I'll wait a bit, if not I'll start reworking a bit the history in there since you said you didn't know how to squash commits. |
Hmm, I have never used the cmd line application, but I was looking at the code and it seems to be feasible. @er-vin There is just one conflict. Option -h and --help is typically used to print help information. The cmd application use -h to Sync hidden files. Any prefrences for this argument? Shall it remain as is? |
Ideally it should remain as is because people using it in scripts should be expected. |
@er-vin Hey, do you really think that the option h is used? I am facing following Problem. |
655819f
to
65552e7
Compare
@er-vin I missed to update documentation. |
Well, you can't never know what user do, right? :-) But it's a tool meant for scripting so I wouldn't underestimate what people do in said scripts.
Interesting, so it'd be broken today? |
Yes, I broke it, but "I can undo it". I thought I will break it because it has not done anything before and now it is more readable. |
Sorry I was being unclear, by "it'd be broken today?" I meant, "it was broken before your changes?" |
Yeah, and I was happy to see that you fixed the path concatenation of makeDbName and something else. I was struggling with that while I was testing it. As I fixed it I saw you fixed or merged it a few days ago as well. |
/rebase |
@AHeimberger we're still interested into this, could you please try to rebase and solve the conflicts? |
@AHeimberger we are still interested into your work. Could you have a look at the comment from @er-vin ? |
I will give it a try. Best Regards |
176dda9
to
feefed5
Compare
f883b4c
to
3dff96b
Compare
6790090
to
f5ec4b7
Compare
f5ec4b7
to
2478024
Compare
2478024
to
e1dbc55
Compare
c6e82dc
to
4a3af3e
Compare
@AHeimberger ervin is no longer part of the team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for sticking around so long on that one. Overall I still think it can be a good improvement, I'm mostly pointing out tiny improvements here. The only think nagging me is the stability of nextcloudcmd CLI which shouldn't be underestimated.
@@ -32,46 +32,56 @@ OPTIONS | |||
``--path`` | |||
Overrides default remote root folder to a specific subfolder on the server(e.g.: /Documents would sync the Documents subfolder on the server) | |||
|
|||
``—user``, ``-u`` ``[user]`` | |||
``--user``, ``-u`` ``[user]`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me wonder, does -user
still work? If not it might be a deal breaker for the change in nextcloudcmd since the exposed CLI can't change there, people are likely using this in scripts and so it'd break them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already had people having to adjust for even more minor workflow changes of nextcloudcmd
it would be best to still offer compatibility maybe with a deprecation warning (and I know that if run from a script nobody will read it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current code is already using --user
and not -user
so that should be fine to do
2ad331f
to
a2f7474
Compare
Codecov Report
@@ Coverage Diff @@
## master #2135 +/- ##
==========================================
- Coverage 56.80% 56.69% -0.12%
==========================================
Files 138 138
Lines 17142 17142
==========================================
- Hits 9737 9718 -19
- Misses 7405 7424 +19
|
…ments Signed-off-by: aheimberger <andreasheimberger@gmx.at>
Signed-off-by: aheimberger <AndreasHeimberger@gmx.at>
a2f7474
to
e13c0e9
Compare
AppImage file: Nextcloud-PR-2135-e13c0e9fbcb1c7318a19fd1ddc0f884d26314b1c-x86_64.AppImage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks again for keeping pushing for this
apologize for the time needed to get a review from me
@@ -763,8 +763,7 @@ QString Theme::versionSwitchOutput() const | |||
{ | |||
QString helpText; | |||
QTextStream stream(&helpText); | |||
stream << appName() | |||
<< QLatin1String(" version ") | |||
stream << QLatin1String("version ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not change that
I am pretty sure that having the appName can be useful in weird situation
{ "logexpire", "Removes logs older than <hours> hours, to be used with --logdir", "hours" }, | ||
{ "logflush", "Clears (flushes) the log output directory" }, | ||
{ "logdebug", "Also outputs debug-level messages in the log", "", "true" }, | ||
{ "confdir", "Uses the given configuration folder", "directory" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implementation of this option is missing
please add it back
const QString logDir = _parser.value("logdir"); | ||
const QString logFile = _parser.value("logfile"); | ||
const int logExpire = _parser.value("logexpire").toInt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use const auto
const QStringList args = _parser.positionalArguments(); | ||
for (int i = 0; i < args.size(); i++) { | ||
QString virtualFile = args.at(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use something like this
const auto args = _parser.positionalArguments();
for(const auto &virtualFile : args) {
{ "uplimit", "Limit the upload speed of files to n KB/s", "n", "0" }, | ||
{ "downlimit", "Limit the download speed of files to n KB/s", "n", "0" }, | ||
{ "logdebug", "More verbose logging" }, | ||
{ "path", "Path to a folder on a remote server" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is taking a parameter
you can probably call it remotePath
QString source_dir = args.at(0); | ||
const QString target_url = args.at(1); | ||
const QString options_user = parser.value("user"); | ||
const QString options_password = parser.value("password"); | ||
const QString proxy = parser.value("httpproxy"); | ||
const bool silent = parser.isSet("silent"); | ||
const bool trustSSL = parser.isSet("trust"); | ||
const bool useNetrc = parser.isSet("netrc"); | ||
const bool interactive = !parser.isSet("non-interactive"); | ||
const bool ignoreHiddenFiles = parser.isSet("ignore-hidden"); | ||
const QString exclude = parser.value("exclude"); | ||
const QString unsyncedfolders = parser.value("unsyncedfolders"); | ||
const int restartTimes = parser.value("max-sync-retries").toInt(); | ||
const int uplimit = parser.value("uplimit").toInt() * 1000; | ||
const int downlimit = parser.value("downlimit").toInt() * 1000; | ||
const bool logdebug = parser.isSet("logdebug"); | ||
const QString remotePath = parser.value("path"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use const auto
everywhere
@@ -62,31 +61,6 @@ static void nullMessageHandler(QtMsgType, const QMessageLogContext &, const QStr | |||
{ | |||
} | |||
|
|||
struct CmdOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why removing it ?
that would have helped reduce the amount of modifications inside this file
Hey Guys, maybe you like this refactoring. It comes with a small issue. In <Windows e.g. 10> the window for showing the help information does not look identically. However I prefer using Qt-Mechanism instead of parsing it free will. Furthermore, if you say it's not direcly necessary to print an information in case the Config-Directory is not valid. It would allow to remove functions like showHint.
Best Regards