Nothing Special   »   [go: up one dir, main page]

Skip to content

Simple CLI Tool that translates your code in ANY programming language!

License

Notifications You must be signed in to change notification settings

mulla028/PolyglotCode

Repository files navigation

PolyglotCode

A command-line tool that helps to translate code in ANY programming language


Java Maven

License: MIT

Getting Started

  1. Generate and provide Cohere API key into the defaultValue of -a && --api-key flag inside of the main class

    @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

    ./python <file(s)...> <language> -a <YOUR-API-KEY>
  2. Make bash script executable, so user would be able to use ./polyglot command to run code

    chmod +x polyglot
  3. Run Maven Package to compile the source code

    mvn package

Usage

usageExampleGIF

./polyglot <file(s)...> <language> [OPTIONS]

Examples:

./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:

./polyglot -v
./polyglot --version

Help

This flag displays all of the details and configurations that PolyglotCode has, usage:

./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:

./polyglot <file(s)...> <language> -a <YOUR-API>
./polyglot <file(s)...> <language> --api-key <YOUR-API>

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:

./polyglot <file(s)...> <language> -u <baseURL>
./polyglot <file(s)...> <language> --base-url <baseURL>

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:

./polyglot <file> <language> -o file.txt
./polyglot <file> <language> --output file.txt

Token information

Displays token information, including input token number and output token number. Usage:

./polyglot <file> <language> -t
./polyglot <file> <language> --token-usage

Stream result

Displays result in the streaming format, as Cohere generates it displays

./polyglot <file> <language> -s
./polyglot <file> <language> --stream

About

Simple CLI Tool that translates your code in ANY programming language!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published