-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Improvements to Command Line Interface #333
Comments
How would this work for more than one ICommandLineProvider? As it is, the CentralScrutinizer class calls each one in turn and then returns a single EXIT_OK |
In my opinion, an additional parameter for the CentralScrutinizer would be the solution:
Currently my problem is the following: I run Archi in batch mode to insert models into a Neo4j database via an ICommandLineProvider plugin. In case an insert fails there is currently only log file reading for me to determine what went wrong, but no upfront indication. |
I like the idea, I just want to think about the best way to do this.
|
The CentralScrutinizer could catch all exceptions thrown by each ICommandLineProvider and if continueAtFailure is false then exit. |
Maybe no need for "continueAtFailure". If something like an "AbortCommandException" is thrown then exit. |
Actually the documentation for start() says: "Applications can return any object they like. If an Integer is returned it is treated as the program exit code if Eclipse is exiting." So, yes that is possible. |
Currently I see two issues:
For now I think the exception is a good thing, which will fix my issue without making a breaking code change for existing plugins (as long as |
Why? I was thinking of:
|
I agree. I had thought about this and wondered about some kind of chaining mechanism rather than a priority-based approach. |
Jep you are totally right, I missed the throws |
Yes, that's true. I put the "abortFlag" there as an example of usage if there was one. I think an Exception is a good idea, but not sure whether all outstanding command providers should be aborted if it is thrown. Why should a plug-in make that decision. The user should make that decision, so maybe the "abortFlag" is necessary. |
That was my thought as well. |
Actually a plugin might throw any exception depending on what it does. At the moment this is thrown onward to the start() method. Should it be the responsibility of the plugin designer to wrap their exceptions in an AbortCommandException or even care about that? Maybe we don't need a special excpetion? |
Regarding the sorting/priority issue: Maybe it is a good idea to let the developer give the plugin an initial priority (so you have some kind of order), that can be overridden by an optional property file in the Archi directory. So if you want one plugin to go first, but do not care about the rest, you could just put in that plugin's Id in the file.
|
One other request. Could you take the "helper functions" from
:-) |
The least intrusive solution would be an optional -abortOnException flag:
|
Sounds good (don't have a "thumbs up" here it seems) |
Ahhh. I think I have just been outed as a Github Forum Neeby :-) |
Not sure how to make that generic. It requires that args come in pairs. Some args might be single. |
I would propose: |
Some ideas:
|
Apache Commons CLI might be useful: |
Changed title of this issue so we can cover many things. I think we have to accept that we will break the current API. But it will be worth it, |
I also had Apache CLI is a good idea. |
I would propose to keep the exsting API functioning if possible and to extend it. I would rather deprecate methods than make a hard break. You could create the |
|
Good ideas. I will create a branch "CLI" here in GitHub and push some experiments. Apache CLI will solve a lot of problems. |
Hi guys, I have one remark regarding the ordering. Why not just use the (JS embedded) script engine so that the command line usage is basically mono-function and one new function being to run a script in which you functions are exposed. @Phillipus this would be in line with the basic idea of an extendable API for Archi that is usable both from CLI and scripts. |
@jbsarrodie Interesting idea. That could be another way to do it. For now, I'm going to improve what we have using Apache CLI. That's an easy win. ;-) |
[Load Empty Model] Load Empty Model These could be combined into one? If path is present load it, otherwise empty? |
I don't think so. I think that they are mutualy exclusive. In addition I would rename loadEmptyModel to createNewModel with an optional argument for the .architemplate to use. But is it possible to have an optional argument ?
For the sake of harmonization I would make all options long ones with "--". In addition, "createHTMLReport" being included in Archi by default I don't know if it makes sens to prefix it with "reports". |
Done. Yes. New output:
|
|
I love that diagram in #333 (comment) We need to agree on what we have now before I add any more CLI providers. |
"CLI" branch commits squashed and rebased onto latest master. Added Export and Import CSV. Import from CSV has a lot of options, feel free to suggest different naming convention:
|
This seems really good !
My sole remark would be that dot should be used only for namespace, so:
I don't know why but IMO first option (use csv namespace) seems better (less weird) |
I agree. BTW - just because I'm a saddo doing this on Boxing Day doesn't meant you have to! Get back to your vacation! ;-) |
I tried it and the csv.* options all got mixed up and not clear whether they belonged to import or export. So maybe to make it clearer use csv.export.*:
|
Prefixing using |
Yep. Better idea. Pushed. |
Regarding export to Jasper - this one has many options: Path to output Suggestions?
Or for all the formats in one option, maybe something like |
It seems we can set In this case I also think using namespace might be more appropriated:
|
Jasper Reports added.
|
Open Exchange Format Import/Export done
|
Wooo ! Seems really nice... and powerful ! |
Now let's agree on option names and descriptions and I'll create a beta build and get some feedback via the Archi forum. (String externalisation in the code will wait until this is agreed) |
Improved descriptions:
|
I've made a new beta build with this in: |
The odd one out to me is: --createHTMLReport Maybe it should be: --reports.createReport ? |
There's an unwanted closing parenthesis after In addition, when something is optional I would make the default option/value explicit everywhere (in csv and xmlexchange)
I see several issues:
Maybe --createHTMLreport is ok now but will have to be changed in the future (FYI I'm working on a fully redesigned HTML export template based on modern web technologies -vue.js and Quasar framework- that will include query and dataviz) |
Corrections pushed. Regarding --createHTMLreport - if you are working on a new template (cool!) then maybe we do need a nice prefix now so we don't have to change again in the future. Maybe something that aligns with --jasper.createReport? Like --html.createReport? |
You could build a whole app with that! |
Yes, that's also part of the idea. In short: html export would "dump" model (including folders and views) in an asql database and export each views to images. The "report app" (what I call Archi Web Client) would then allow to:
The next step would be to make this app aware of GitHub/BitBucket/GitLab.... API to add enhanced features for those using the collaboration plugin:
|
I've opened this up for public testing and feedback: |
@Michael4713 Did you test this version? Does it fulfil requirements? |
Yep, from my current status this looks very good. Currently all my wishes are fullfilled :-) |
Released in 4.2. If any changes/additions are needed please open a new issue. |
Version of Archi, Operating System
4.1.2 on Windows
Expected Behaviour
When implementing an ICommandLineProvider, it should be possible to set an EXIT status.
Actual Behaviour
Currently the Exit Status is hard coded to "EXIT_OK". The ICommandLineProvider should be extended with a default method (e.g. int getExitStatus()), that can be overriden, to allow also that System.exit(-1) can be handed back to the calling command line party.
The text was updated successfully, but these errors were encountered: