-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55cec9d
commit 59f030d
Showing
4 changed files
with
206 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Table of contents | ||
|
||
* [😎 dotlang](README.md) | ||
* [😁 Basics](basics.md) | ||
* [😉 Advanced](advanced.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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! |