Skip to content

Commit

Permalink
Add option to uninstall Argon plugin using command
Browse files Browse the repository at this point in the history
  • Loading branch information
DervexDev committed May 2, 2024
1 parent 16751b9 commit b907e3e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

- Server address preview when running `Argon Stop`, suggested by [@Arid](https://github.com/AridAjd)
- `Verbose` mode in the extension settings to enable easier debugging
- Option to uninstall Argon plugin

### Improved

Expand Down
4 changes: 2 additions & 2 deletions src/argon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export function studio(check?: boolean) {
spawn(['studio', ...args])
}

export function plugin() {
spawn(['plugin', 'install'])
export function plugin(mode: string) {
spawn(['plugin', mode])
}

export function version() {
Expand Down
2 changes: 1 addition & 1 deletion src/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export async function onDidAccept(action: string, state: State) {
studio.handler()
break
case 'plugin':
plugin.handler()
await plugin.handler()
break

case 'settings':
Expand Down
36 changes: 33 additions & 3 deletions src/menu/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
import * as vscode from 'vscode'
import * as argon from '../argon'
import { Item } from '.'

export const item: Item = {
label: '$(plug) Plugin',
description: 'Install Argon plugin for Roblox Studio locally',
description: 'Install or uninstall Argon plugin for Roblox Studio',
action: 'plugin',
}

export function handler() {
argon.plugin()
function getMode(): Promise<string> {
return new Promise((resolve, reject) => {
const items = [
{
label: '$(arrow-down) Install',
mode: 'install',
},
{
label: '$(x) Uninstall',
mode: 'uninstall',
},
]

vscode.window
.showQuickPick(items, {
title: 'Select command mode',
})
.then((mode) => {
if (!mode) {
return reject()
}

resolve(mode.mode)
})
})
}

export async function handler() {
const mode = await getMode()

argon.plugin(mode)
}

0 comments on commit b907e3e

Please sign in to comment.