Skip to content

Commit

Permalink
fix install & updating
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvr committed Apr 17, 2023
1 parent 17e39dc commit 8495e56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { REPO_INSTALL_URL, getLatestVersion, install, isLatestVersion } from "./
console.log(`%cShellGPT ${VERSION} installer`, 'font-size: 2em; font-weight: bold;')

let config = await loadConfig()
if (config) {
if (config && Object.keys(config).length > 0) {
console.log('Found existing config file at %c~/.gpt/config.json', 'font-weight: bold')
}

Expand All @@ -27,12 +27,12 @@ if (!await isLatestVersion()) {

if (!config) {
console.log('Creating new config at %c~/.gpt/config.json', 'font-weight: bold')
config = DEFAULT_CONFIG
config = {...DEFAULT_CONFIG}
saveConfig(config)
}

// What command should be used to invoke gpt?
console.log(`\nWhat command should be used to invoke gpt?\n(default: %c${config.command ?? DEFAULT_CONFIG.command}%c, leave blank to use default)`, 'color: green', 'color: gray')
console.log(`\nWhat command should be used to invoke gpt?\n(default: %c${config.command || DEFAULT_CONFIG.command}%c, leave blank to use default)`, 'color: green', 'color: gray')
const command = prompt('>')
if (command) {
config.command = command
Expand Down
4 changes: 2 additions & 2 deletions lib/data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatCompletionRequest } from "./ai.ts"
import { genDescriptiveNameForChat } from "./prompts.ts";

export const VERSION = '0.2.5'
export const VERSION = '0.2.6'
export const AUTO_UPDATE_PROBABILITY = 0.1

export type Config = {
Expand All @@ -19,7 +19,7 @@ export const DEFAULT_CONFIG: Config = {
lastUpdated: new Date().toISOString(),
version: VERSION,
autoUpdate: 'prompt',
command: undefined,
command: 'gpt',
latestName: undefined,
hasDescriptiveName: undefined,
model: undefined,
Expand Down
3 changes: 2 additions & 1 deletion lib/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export const install = async (config: Config, isUpdate = false): Promise<{
if (isUpdate) {
installCommand = `deno install -frA -n ${alias} ${REPO_MOD_URL}@${latestVersion}`
} else {
installCommand = `deno install -frA -n ${alias} mod.ts`
const modPath = Deno.mainModule.replace('install.ts', 'mod.ts')
installCommand = `deno install -frA -n ${alias} ${modPath}`
}

console.log(`\n$ %c${installCommand}`, 'color: blue')
Expand Down

0 comments on commit 8495e56

Please sign in to comment.