-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from rishi255/develop
Refactor and new Enter-CompletionKeybind feature
- Loading branch information
Showing
16 changed files
with
340 additions
and
150 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,3 +1,5 @@ | ||
shared_with_containers_dir | ||
|
||
# Environments | ||
.env | ||
|
||
|
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,3 +1,37 @@ | ||
FROM deepseek-coder-v2:16b | ||
FROM deepseek-coder:6.7b | ||
|
||
SYSTEM "You are a PowerShell terminal expert who knows ONLY PowerShell and no other language. \nPlease help me complete the following commands in valid PowerShell syntax, you should ONLY output the completed command while keeping it as simple as possible, no need to include any other explanation. Do not put completed command in a code block. You can use PowerShell aliases as well to make commands simpler for beginners coming from Linux." | ||
SYSTEM """You are a PowerShell expert AI for autocompletion in the terminal, that knows ONLY PowerShell and no other language. Please help me complete the following commands in valid PowerShell syntax, while always following these 3 rules: 1. You should ONLY output the completed PowerShell code in a few lines (maximum) while keeping it as simple as possible, do not include any other text or explanations. 2. Do NOT use code blocks in output. 3. DO NOT use commands that are invalid in PowerShell.""" | ||
|
||
PARAMETER num_predict -2 | ||
PARAMETER temperature 0.4 | ||
PARAMETER num_ctx 4096 | ||
PARAMETER repeat_last_n -1 | ||
|
||
MESSAGE user Print "hello world" to the console. | ||
MESSAGE assistant echo "Hello world" | ||
MESSAGE user Print all directories containing "python" in the current directory | ||
MESSAGE assistant Get-ChildItem | findstr "python" | ||
MESSAGE user Rename each directory found in the previous example to append "_py" at the end | ||
MESSAGE assistant foreach ($dir in $(gci -Name | findstr "python")) { mv "$dir" $dir"_py" } | ||
MESSAGE user Reload current powershell profile present in $PROFILE | ||
MESSAGE assistant . $PROFILE | ||
MESSAGE user Run "testing.py" and store the output in "output.txt" | ||
MESSAGE assistant python testing.py > output.txt | ||
MESSAGE user Move each directory containing "python" to the Desktop | ||
MESSAGE assistant Get-ChildItem -Directory -fi *python* | Move-Item -Destination ~/Desktop/ | ||
MESSAGE user List all ruby files in the current folder | ||
MESSAGE assistant Get-ChildItem | where Name -match '\.rb$' | ||
MESSAGE user Display names of all text files in all subfolders recursively | ||
MESSAGE assistant gci -r -LiteralPath . | where { $_.Name -like "*.txt" } | ||
MESSAGE user Delete the file with the smallest size in the current directory | ||
MESSAGE assistant gci . | sort Length | select -First 1 | rm | ||
MESSAGE user Print the most recently modified file in the directory called "tests" | ||
MESSAGE assistant gci tests | sort LastWriteTime | select -Last 1 | remove-item | ||
MESSAGE user Delete the most recently modified ruby file in all subfolders of Desktop | ||
MESSAGE assistant gci -LiteralPath ~/Desktop -r -fi *.rb | sort LastWriteTime | select -Last 1 | remove-item | ||
MESSAGE user Rename all javascript files in all subfolders by adding "js_" to the beginning of the filenames | ||
MESSAGE assistant gci -r -fi *.js | Rename-Item -NewName { "js_" + $_.Name }; | ||
MESSAGE user Print only the file extensions of each file in the current directory | ||
MESSAGE assistant gci -File | select Extension | ||
MESSAGE user Append the filename with extension to each file in the current directory | ||
MESSAGE assistant foreach ($file in $(gci -File *.txt)) {echo $file.Extension >> $file} |
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
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
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,37 @@ | ||
#Requires -Modules PSReadLine | ||
|
||
# Function to convert a user input key press into a keybind string | ||
function Convert-KeyPressToString { | ||
# Add cmdletBinding to the parameter list | ||
[CmdletBinding()] | ||
param($key) | ||
|
||
# First, check and append Ctrl if it's pressed | ||
if ($key.Modifiers -band [ConsoleModifiers]::Control) { | ||
$keybind += 'Ctrl+' | ||
} | ||
|
||
# Next, check and append Alt if it's pressed | ||
if ($key.Modifiers -band [ConsoleModifiers]::Alt) { | ||
$keybind += 'Alt+' | ||
} | ||
|
||
# Lastly, check and append Shift if it's pressed | ||
if ($key.Modifiers -band [ConsoleModifiers]::Shift) { | ||
$keybind += 'Shift+' | ||
} | ||
|
||
# Append the actual key that was pressed | ||
$keybind += $key.Key.ToString() | ||
|
||
# Display the keybind string | ||
# Write-Host "Keybind entered: $keybind" | ||
|
||
# If the Escape key is pressed, exit the loop | ||
if ($key.Key -eq 'Escape') { | ||
Write-Host 'Aborted by user, exiting...' | ||
return $null | ||
} | ||
|
||
return $keybind | ||
} |
This file was deleted.
Oops, something went wrong.
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
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,21 @@ | ||
#Requires -Modules PSReadLine | ||
|
||
# Function to simply handle the setting and removal of keybinds, without worrying about the user input. | ||
function Set-CompletionKeybind { | ||
# Add cmdletBinding to the parameter list | ||
[CmdletBinding()] | ||
param( | ||
$old_keybind, $new_keybind | ||
) | ||
|
||
if ($null -ne $old_keybind) { | ||
# unset current handler for Write-Completion if it exists | ||
Remove-PSReadLineKeyHandler -Chord $old_keybind | ||
Write-Host "Previous keybind removed: $old_keybind" | ||
} | ||
|
||
Set-PSReadLineKeyHandler -Chord $new_keybind ` | ||
-BriefDescription Write-Completion ` | ||
-LongDescription 'Autocomplete the command' ` | ||
-ScriptBlock { Write-Completion } | ||
} |
File renamed without changes.
Oops, something went wrong.