CliInterface refactoring
ClosedPublic

Authored by rthomsen on Nov 2 2016, 6:05 PM.

Details

Summary

CliInterface is refactored by creating a new class (CliParameters) which stores and handles all commands, switches and regexp patterns used for interacting with the cli executables.

Diff Detail

Repository
R36 Ark
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rthomsen updated this revision to Diff 7839.Nov 2 2016, 6:05 PM
rthomsen retitled this revision from to CliInterface refactoring.
rthomsen updated this object.
rthomsen edited the test plan for this revision. (Show Details)
rthomsen added a reviewer: elvisangelaccio.
Restricted Application added a project: Ark. · View Herald TranscriptNov 2 2016, 6:05 PM
Restricted Application added a subscriber: kde-utils-devel. · View Herald Transcript
elvisangelaccio requested changes to this revision.Nov 3 2016, 1:49 PM
elvisangelaccio edited edge metadata.

I just had a quick look, but overall it looks fine :)

kerfuffle/archiveinterface.cpp
56

This check should be the first thing in the ctor

kerfuffle/cliinterface.h
72–73

This method in not really necessary. Every plugin could just do the setup in their own constructor (since they have access to m_cliParameters).
This way we can also drop the need for cacheParameterList().

86

Why move this from private to public?

105

Make it protected and add a public getter

kerfuffle/cliparameters.h
38–76 ↗(On Diff #7839)

Since this new class is not only about parameters/switches but also other CLI stuff (regexes, etc.) maybe we should find a more descriptive name, though I can't think any at the moment :p

81 ↗(On Diff #7839)

Once you drop CliInterface::cacheParameterList() you can probably drop this as well.

106 ↗(On Diff #7839)

unnecessary keyword

This revision now requires changes to proceed.Nov 3 2016, 1:49 PM
rthomsen updated this revision to Diff 7872.Nov 3 2016, 6:33 PM
rthomsen edited edge metadata.
rthomsen marked 4 inline comments as done.
  • Implement Elvis' suggestions.
  • Merge branch 'master' into cli-refactor
This revision was automatically updated to reflect the committed changes.
rthomsen reopened this revision.Nov 3 2016, 7:39 PM
rthomsen marked 3 inline comments as done.
rthomsen updated this revision to Diff 7874.Nov 3 2016, 8:22 PM
rthomsen edited edge metadata.

Upload a new diff manually, since arc messed it up.

elvisangelaccio requested changes to this revision.Nov 4 2016, 4:28 PM
elvisangelaccio edited edge metadata.
elvisangelaccio added inline comments.
kerfuffle/cliinterface.h
54–58

Maybe we should keep the docs in this enum. You can move them above the Q_PROPERTY they end up in.

146

This method can be moved back to the private section.

kerfuffle/cliproperties.h
82–110

All the methods of the new class can be marked as const , it seems.

This revision now requires changes to proceed.Nov 4 2016, 4:28 PM
rthomsen updated this revision to Diff 7908.Nov 4 2016, 6:14 PM
rthomsen edited edge metadata.
  • Make substitute* functions in CliProperties class const.
  • Make CliInterface::escapeFileName() private again.
rthomsen marked 2 inline comments as done.Nov 4 2016, 6:15 PM
rthomsen added inline comments.
kerfuffle/cliinterface.h
54–58

I would rather not keep the doc. It reduces the readability of the code and most of the properties are pretty self-explanatory.

elvisangelaccio requested changes to this revision.Nov 4 2016, 6:36 PM
elvisangelaccio edited edge metadata.
elvisangelaccio added inline comments.
plugins/cliunarchiverplugin/cliplugin.h
58

One more thing: since all cli plugins need this method, make it virtual and call in just once in the CliInterface ctor

This revision now requires changes to proceed.Nov 4 2016, 6:36 PM
elvisangelaccio accepted this revision.Nov 4 2016, 7:01 PM
elvisangelaccio edited edge metadata.
elvisangelaccio added inline comments.
plugins/cliunarchiverplugin/cliplugin.h
58

Forgot that virtual methods can't be called from the base class ctor. Ignore this.

This revision is now accepted and ready to land.Nov 4 2016, 7:01 PM
This revision was automatically updated to reflect the committed changes.