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

Implemented version command #8

Open
wants to merge 1 commit into
base: official
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,18 @@ Fetch the capability of a Threema ID

####Decrypt and download
java -jar threema-msgapi-tool.jar -D <id> <from> <secret> <privateKey> <messageId> <nonce> [outputFolder]
Decrypt a box (box from the stdin) message and download (if the message is a image or file message) the file(s) to the defined directory
Decrypt a box (box from the stdin) message and download (if the message is a image or file message) the file(s) to the defined directory

## Feature Levels

| Level | Text | Capabilities | Image | File | Credits |
|-------|------|--------------|-------|------|---------|
| 1 | X | | | | |
| 2 | X | X | X | X | |
| 3 | X | X | X | X | X |

You can see the implemented feature level by invoking the following command:

```
$ java -jar threema-msgapi-tool.jar -v
```
8 changes: 8 additions & 0 deletions source/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<source.encoding>UTF-8</source.encoding>
<project.build.sourceEncoding>${source.encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${source.encoding}</project.reporting.outputEncoding>
<property.featureLevel>3</property.featureLevel>
</properties>

<organization>
Expand Down Expand Up @@ -55,6 +56,13 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
4 changes: 3 additions & 1 deletion source/src/main/java/ch/threema/apitool/ConsoleMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ public static void main(String[] args) throws Exception {
.add(new HashEmailCommand(), "-h", "-e")
.add(new HashPhoneCommand(), "-h", "-p")
.add(new GenerateKeyPairCommand(), "-g")
.add(new DerivePublicKeyCommand(), "-p");
.add(new DerivePublicKeyCommand(), "-p")
.add(new VersionCommand(), "-v");


commands.create("Network operations")
.add(new SendSimpleMessageCommand(), "-s")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* $Id$
*
* The MIT License (MIT)
* Copyright (c) 2016 Threema GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE
*/

package ch.threema.apitool.console.commands;

import java.io.InputStream;
import java.util.Properties;

public class VersionCommand extends Command {

public VersionCommand() {
super("Version", "Prints the current version and feature level. ");
}

@Override
protected void execute() throws Exception {
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("app.properties");
Properties p = new Properties();
p.load(inputStream);
System.out.println("Version: "+p.getProperty("version")+"\nFeature level: "+p.getProperty("feature.level"));
}
}
2 changes: 2 additions & 0 deletions source/src/main/resources/app.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=${project.version}
feature.level=${property.featureLevel}