Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mulla028/polyglotcode
Simple CLI Tool that translates your code in ANY programming language!
https://github.com/mulla028/polyglotcode
cli java maven picocli
Last synced: 1 day ago
JSON representation
Simple CLI Tool that translates your code in ANY programming language!
- Host: GitHub
- URL: https://github.com/mulla028/polyglotcode
- Owner: mulla028
- License: mit
- Created: 2024-09-11T00:16:47.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-11-25T17:19:11.000Z (2 months ago)
- Last Synced: 2024-11-25T18:26:29.976Z (2 months ago)
- Topics: cli, java, maven, picocli
- Language: Java
- Homepage:
- Size: 79.1 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
![PolyglotCode](https://github.com/user-attachments/assets/2ee7a351-b467-4935-a189-11824cb63387)
**A command-line tool that helps to translate code in ANY programming language**
![Java](https://img.shields.io/badge/Java-ED8B00?style=for-the-badge&logo=java&logoColor=blue)
![Maven](https://img.shields.io/badge/apache_maven-C71A36?style=for-the-badge&logo=apachemaven&logoColor=black)[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
# Maven Central Repository
Instructions on how to integrate this tool to your project you may find [here](https://central.sonatype.com/artifact/io.github.mulla028/PolyglotCode)
# Getting Started
1. Generate and provide Cohere API key into the defaultValue of -a && --api-key flag inside of the main class
```java
@Option(
names = {"-a", "--api-key"},
defaultValue = "YOUR_API-KEY",
description = "Modifying api key manually"
)
private String api;
```
or
Specify call and provide the api-key into the command line, using flags
```bash
./python -a
```3. Make bash script executable, so user would be able to use `./polyglot` command to run code
```bash
chmod +x polyglot
```4. Run Maven Package to compile the source code
```bash
mvn package
```# Usage
![usageExampleGIF](https://github.com/user-attachments/assets/2a4014c1-7b51-48cc-b3cc-c642a4e34423)
```bash
./polyglot [OPTIONS]
```Examples:
```bash
./polyglot main.cpp java
./polyglot examples/example.py main.cpp c# -o output.cs
```# Different Flags
### Version info
This flag prints the current version of PolyglotCode and the name of the tool, usage:
```bash
./polyglot -v
./polyglot --version
```### Help
This flag displays all of the details and configurations that PolyglotCode has, usage:
```bash
./polyglot -h
./polyglot --help
```### Specify API - KEY
As it was mentioned earlier, user is able to specify Cohere-Api key without adding it to the defaultValue property of String api inside of the main class, usage:
```bash
./polyglot -a
./polyglot --api-key
```### Specify baseURL
It is not recommended to change the baseUrl of this application, as it may produce an unexpected output; however this option is still available to the user, usage:
```bash
./polyglot -u
./polyglot --base-url
```### Write the result to the file
Creates the file, specified by user and writes the result there. It is highly recommended to use this option with one file at the time. Usage:
```bash
./polyglot -o file.txt
./polyglot --output file.txt
```### Token information
Displays token information, including input token number and output token number. Usage:
```bash
./polyglot -t
./polyglot --token-usage
```### Stream result
Displays result in the streaming format, as Cohere generates it displays
```bash
./polyglot -s
./polyglot --stream
```