diff --git a/README.md b/README.md index 95d5d2c..961e662 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,25 @@ -# dotlang +# 😎 dotlang + a powerful cross-platform Superset for Powershell that extends the functionality of the native PowerShell language. It introduces new features, syntax enhancements, and additional functionalities to make scripting and automation tasks more efficient and effective. ## Example + 1- import dotlang, + ```powershell -Import-Module ./dot.ps1 # Imports dotlang -``` -or, -```powershell -. ./dot.ps1 # Imports dotlang +Import-Module .\dot.ps1 # Imports dotlang ``` + 2- use it :) + ```powershell printTxt("Hi I'm dotlang!"); # simicolon (;) is optional. ``` -## Full Usage Guide -check the [Wiki](https://github.com/neoapps-dev/dotlang/wiki) for full usage guide. +## Full Usage + +Check the [GitBook](https://neoapps.gitbook.io/dotlang) for full usage guide ## License -This code is licensed under the MIT License. -check LICENSE.TXT for more info + +This code is licensed under the MIT License. check LICENSE.TXT for more info diff --git a/SUMMARY.md b/SUMMARY.md new file mode 100644 index 0000000..51b111e --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,5 @@ +# Table of contents + +* [😎 dotlang](README.md) +* [😁 Basics](basics.md) +* [😉 Advanced](advanced.md) diff --git a/advanced.md b/advanced.md new file mode 100644 index 0000000..af8c967 --- /dev/null +++ b/advanced.md @@ -0,0 +1,116 @@ +# 😉 Advanced + +## Advanced Commands + +woah! you made it here! alright let's start. + +### Imports + +as you've learned in the basics, `Import-Module` is the default powershell cmdlet to import functions and variables from other scripts, to that in dotlang, simply: + +```powershell +import ".\anotherfile.ps1"; +# or, +import(".\anotherfile.ps1"); +``` + +simple ain't it? + +### Encrypting and Decrypting data + +yeah, we have this in dotlang :) + +```powershell +$key = dotaes; # you can just use `$key = "YOUR_KEY_HERE"` +$key; # optional, displays encrypting key +$unencryptedString = "blahblahblah"; +# Encrypting +$encryptedString = EncryptData $key $unencryptedString; +# Decrypting +$backToPlainText = DecryptData $key $encryptedString; +``` +output: + +![image](https://github.com/user-attachments/assets/92885fea-9a88-4589-b3fb-64713e28adf5) + + +### Asynchronous Command Execution + +for short, `async`! + +very easy, To make an async job: + +```powershell +$jobID = dotasync("Long_Running_Command"); +function isCompleted { +if (dotasync_check($jobID)) { +printTxt("Job Finished!"); +printTxt("Job Returned:"); +dotasync_get($jobID); +} else { +isCompleted +} +} +isCompleted +``` + +Output: ![image](https://github.com/neoapps-dev/dotlang/assets/158327205/74cbb72a-bf3d-4a69-8ea8-81b91f1144e6) + +that was pretty advanced, ain't it? + +### Executing Commands on an other PC + +yeah.. it doesn't support dotlang commands, only powershell (sorry).. + +```powershell +dotremote "ComputerName or Address" "Powershell command"; +``` + +### Monitoring Processes + +```powershell +MonitorProcess "ProccessName" { +# action on proccess start goes here +}; +``` + +### Run As Admin/User + +```powershell +Invoke-InContext Admin "Write-Host hii" # run command as admin in another window +Invoke-InContext User "Write-Host hii" # run command as a user (not admin) +``` + +Output: ![image](https://github.com/neoapps-dev/dotlang/assets/158327205/410f7c5b-5e08-4e20-855c-bda8f6559a59) + +### Schedule commands + +yep. and it's easy. + +```powershell +dotschedule "Command" "Time"; +``` + +![image](https://github.com/neoapps-dev/dotlang/assets/158327205/3abf287f-822f-4603-b322-96a700a469f2) + +### Get Current OS + +```powershell +$currentOS = Get-OS; +printTxt("You're running a $currentOS machine!"); # 'windows' for Windows, 'mac' for MacOS, 'gnu' for GNU/Linux +``` + +![image](https://github.com/neoapps-dev/dotlang/assets/158327205/027b69ef-4404-4975-94a0-456a67bd2950) + +### Amazing TUIs + +hello TUIs dev. it's now MUCH easier to make TUIs with `dotlang`! here's an example: + +```powershell +$inp = dotui "What do you use?" "Windows","GNU/Linux","MacOS"; +printTxt("You've choosen the input $($inp+1)"); +``` + +Usage: dotui "Title" "Input 0","Input 1","Input 3", etc... + +Result: ![image](https://github.com/user-attachments/assets/4a587fe8-2e08-4151-83ce-2ab7dae0797b) diff --git a/basics.md b/basics.md new file mode 100644 index 0000000..745e684 --- /dev/null +++ b/basics.md @@ -0,0 +1,73 @@ +# 😁 Basics + +Of course, every language starts with the basics. + +The first thing you have to do is create a new project, to do so: + +### Creating your first project. + +1- Make a folder anywhere after installing dotlang + +2- Open the terminal in that folder you have created + +3- type in: `dot new` and output should be: + +![image](https://github.com/neoapps-dev/dotlang/assets/158327205/8e2e5336-b7cf-4990-9104-21731815f514) + +4- now open `main.dot` in any of your favourite code editors (e.g. VS Code, Notepad++, etc.) + +5- you're gonna see the first line `Import-Module .\dot.ps1`, do NOT touch it, this will import dotlang. + +6- you're now ready to learn the basics!! + +## Basic Commands + +... + +### Print Text + +To print a text on the screen simply, + +```powershell +printTxt("Hi I'm dotlang!"); # semicolons are optional. +``` + +### Print Warning + +To print a warning text (yellow and followed by the word WARNING:) simply, + +```powershell +printWarning("This is a test!"); # Output: WARNING: This is a test! +``` + +### Print Errors, + +ever thought of showing an error to the user? well you can! simply, + +```powershell +printError("This is just a test!"); +``` + +Output: ![image](https://github.com/neoapps-dev/dotlang/assets/158327205/4e037a65-4f31-4c4d-9a38-3b4ff79202d6) + +### Print Colored Text + +yeah! text with your own custom color! simply, + +```powershell +printColored "I'm green!" "Green"; +``` + +Output: ![image](https://github.com/neoapps-dev/dotlang/assets/158327205/14cc4707-db18-4b7f-83d7-5feac8b2e565) + +### Print Progress + +your code takes time to execute? no worries just simply use, + +```powershell +printProgress "Activity" "Status"; +``` + +Output: ![image](https://github.com/neoapps-dev/dotlang/assets/158327205/432ddf25-d2c7-4ccf-a61a-b70a2ed33de4) + +That's it for basic commands!