UNPKG

yosi.ai

Version:

AI-powered code generation tool using Google's Gemini API

237 lines (153 loc) 4.48 kB
# Language Guide for yosi.ai This guide covers how to use yosi.ai with different programming languages. ## Table of Contents - [JavaScript](#javascript) - [TypeScript](#typescript) - [Python](#python) - [Java](#java) - [C#](#c) - [Go](#go) - [Ruby](#ruby) - [PHP](#php) - [Swift](#swift) - [Rust](#rust) ## JavaScript JavaScript is the default language for yosi.ai. ### Basic Function ```bash yosi "create a function that calculates the factorial of a number" ``` ### ES6 Class ```bash yosi "create an ES6 class for a shopping cart with methods to add, remove, and calculate total" ``` ### Async/Await ```bash yosi "create an async function that fetches data from an API and handles errors" ``` ## TypeScript Specify TypeScript using the `--language typescript` option. ### Interface and Class ```bash yosi --language typescript "create an interface and class for a User with name, email, and role properties" ``` ### Generic Function ```bash yosi --language typescript "create a generic function that can filter an array of any type" ``` ### Type Guards ```bash yosi --language typescript "create type guards for different shapes of API responses" ``` ## Python Specify Python using the `--language python` option. ### Class ```bash yosi --language python "create a Python class for a bank account with deposit and withdraw methods" ``` ### Decorator ```bash yosi --language python "create a decorator that measures the execution time of a function" ``` ### Context Manager ```bash yosi --language python "create a context manager for handling file operations" ``` ## Java Specify Java using the `--language java` option. ### Class ```bash yosi --language java "create a Java class for a student with name, ID, and grades" ``` ### Interface Implementation ```bash yosi --language java "create an interface for a payment processor and a class that implements it" ``` ### Exception Handling ```bash yosi --language java "create a custom exception class and demonstrate how to use it" ``` ## C# Specify C# using the `--language csharp` option. ### Class ```bash yosi --language csharp "create a C# class for a product with properties and methods" ``` ### LINQ Query ```bash yosi --language csharp "create a LINQ query to filter and sort a list of objects" ``` ### Async Method ```bash yosi --language csharp "create an async method that reads data from a file" ``` ## Go Specify Go using the `--language go` option. ### Struct and Methods ```bash yosi --language go "create a Go struct for a person with methods to get and set properties" ``` ### Interface ```bash yosi --language go "create a Go interface for a reader and a struct that implements it" ``` ### Goroutine ```bash yosi --language go "create a function that uses goroutines to process data concurrently" ``` ## Ruby Specify Ruby using the `--language ruby` option. ### Class ```bash yosi --language ruby "create a Ruby class for a blog post with title, content, and author" ``` ### Module ```bash yosi --language ruby "create a Ruby module for utility functions and a class that includes it" ``` ### Block Usage ```bash yosi --language ruby "create a method that takes a block and demonstrates yield" ``` ## PHP Specify PHP using the `--language php` option. ### Class ```bash yosi --language php "create a PHP class for a user with properties and methods" ``` ### Interface ```bash yosi --language php "create a PHP interface for a logger and a class that implements it" ``` ### Trait ```bash yosi --language php "create a PHP trait for handling database connections" ``` ## Swift Specify Swift using the `--language swift` option. ### Class ```bash yosi --language swift "create a Swift class for a vehicle with properties and methods" ``` ### Protocol ```bash yosi --language swift "create a Swift protocol for a drawable object and a struct that conforms to it" ``` ### Extension ```bash yosi --language swift "create a Swift extension for the String class with additional functionality" ``` ## Rust Specify Rust using the `--language rust` option. ### Struct and Implementation ```bash yosi --language rust "create a Rust struct for a rectangle with methods to calculate area and perimeter" ``` ### Trait ```bash yosi --language rust "create a Rust trait for a shape and a struct that implements it" ``` ### Error Handling ```bash yosi --language rust "create a function that demonstrates Rust's error handling with Result" ```