Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Update comments and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jun 30, 2016
1 parent 87cc292 commit acd9ab5
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
21 changes: 21 additions & 0 deletions docs/commands/glossary-delete.md
@@ -0,0 +1,21 @@
To delete glossary entry in Zanata, the command-line client's `glossary-delete` command can be used.

```bash
zanata-cli glossary-delete --id 1005
```

This command will:

1. Look up the server config from `zanata.xml`.
2. Delete glossary entry with id `1005`

To delete all glossary in Zanata

```bash
zanata-cli glossary-delete --all
```

To see all options available for `glossary-delete` option:
```bash
zanata-cli help glossary-delete
```
4 changes: 2 additions & 2 deletions docs/commands/glossary-pull.md
Expand Up @@ -10,14 +10,14 @@ This command will:
2. Download all glossary entries in server
3. The file will be in `.csv` format. (default)

To download different as format, use the `--file-type` options (csv or po).
To download in different format, use the `--file-type` options (csv or po).
For example:

```bash
zanata-cli glossary-pull --file-type po
```

To download only few locales for `--file-type po`, use the ` --trans-lang` options.
To download only specific locales for `--file-type po`, use the ` --trans-lang` options.
For example to download `de` and `fr` locales only:

```bash
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Expand Up @@ -21,6 +21,7 @@ pages:
- pull: 'commands/pull.md'
- glossary-push: 'commands/glossary-push.md'
- glossary-pull: 'commands/glossary-pull.md'
- glossary-delete: 'commands/glossary-delete.md'
- Maven Plugin:
- Installation: 'maven-plugin/installation.md'
- Configuration: 'maven-plugin/configuration.md'
Expand Down
Expand Up @@ -27,7 +27,7 @@ public void setId(String id) {
}

@Option(name = "--all", metaVar = "ALL",
usage = "Delete entire glossaries in server. Default: false")
usage = "Delete entire glossaries from the server. Default: false")
public void setAllGlossary(boolean allGlossary) {
this.allGlossary = allGlossary;
}
Expand All @@ -44,6 +44,6 @@ public String getCommandName() {

@Override
public String getCommandDescription() {
return "Delete glossary entry in Zanata";
return "Delete glossary entries in Zanata";
}
}
Expand Up @@ -20,7 +20,7 @@ public class GlossaryPullOptionsImpl extends ConfigurableGlossaryOptionsImpl

@Option(name = "--file-type", metaVar = "(CSV or PO)",
usage = "File type to be downloaded.\n" +
"csv - csv file format with comma separated\n" +
"csv (default) - csv file format with comma separated\n" +
"po - a zip file of po files on available locales")
public void setFileType(String fileType) {
this.fileType = fileType;
Expand Down
Expand Up @@ -95,7 +95,7 @@ private String validateFileExtensionWithTransLang() throws RuntimeException {
if (fileExtension.equals("po")
&& StringUtils.isBlank(getOpts().getTransLang())) {
throw new RuntimeException(
"Option 'zanata.transLang' is required for this file type.");
"Option '--trans-lang' is required for this file type.");
}
return fileExtension;
}
Expand All @@ -113,21 +113,21 @@ public void run() throws Exception {

if (glossaryFile == null) {
throw new RuntimeException(
"Need to specify file to push. Use --file to specify file to upload.");
"Option '--file' is required.");
}
if (!glossaryFile.exists()) {
throw new RuntimeException("File '" + glossaryFile
+ "' does not exist - check file option");
+ "' does not exist. Check '--file' option");
}

if (getOpts().getSourceLang() == null
|| getOpts().getSourceLang().length() < 0) {
throw new RuntimeException(
"Need to specify source language. Use --src-lang to specify the source language.");
"Option '--src-lang' is required for source language.");
}

if (getOpts().getBatchSize() <= 0) {
throw new RuntimeException("Batch size needs to be 1 or more.");
throw new RuntimeException("Option '--batch-size' needs to be 1 or more.");
}

String fileExtension = validateFileExtensionWithTransLang();
Expand Down
Expand Up @@ -6,6 +6,9 @@
import org.zanata.client.commands.ConfigurableOptions;

public interface GlossaryPushOptions extends ConfigurableGlossaryOptions {
public String DEFAULT_SOURCE_LANG = "en-US";
public int DEFAULT_BATCH_SIZE = 50;

public File getFile();

public String getSourceLang();
Expand Down
Expand Up @@ -13,12 +13,12 @@ public class GlossaryPushOptionsImpl extends ConfigurableGlossaryOptionsImpl
implements GlossaryPushOptions {

private File file;
private String sourceLang;
private String sourceLang = DEFAULT_SOURCE_LANG;
private String transLang;
private int batchSize;
private int batchSize = DEFAULT_BATCH_SIZE;

@Option(name = "--file",
usage = "Location path for the glossary file.")
usage = "Location path for the glossary file.", required = true)
public void setFile(File file) {
this.file = file;
}
Expand Down
Expand Up @@ -42,7 +42,7 @@ public class GlossaryPushMojo extends GlossaryMojo<GlossaryPushOptions>
*
* @parameter expression="${zanata.sourceLang}" default-value="en-US"
*/
private String sourceLang = "en-US";
private String sourceLang = DEFAULT_SOURCE_LANG;

/**
* Translation language of document. Not required for csv file
Expand All @@ -64,7 +64,7 @@ public class GlossaryPushMojo extends GlossaryMojo<GlossaryPushOptions>
*
* @parameter expression="${zanata.batchSize}" default-value=50
*/
private int batchSize = 50;
private int batchSize = DEFAULT_BATCH_SIZE;

public GlossaryPushMojo() throws Exception {
super();
Expand Down

0 comments on commit acd9ab5

Please sign in to comment.