GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(install): check if the path export command already exists (#28) · ccheever/opencode@ec928d8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • install
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎install‎

Copy file name to clipboardExpand all lines: install
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ add_to_path() {
107107
local config_file=$1
108108
local command=$2
109109

110-
if [[ -w $config_file ]]; then
110+
if grep -Fxq "$command" "$config_file"; then
111+
print_message info "Command already exists in $config_file, skipping write."
112+
elif [[ -w $config_file ]]; then
111113
echo -e "\n# opencode" >> "$config_file"
112114
echo "$command" >> "$config_file"
113115
print_message info "Successfully added ${ORANGE}opencode ${GREEN}to \$PATH in $config_file"
@@ -173,6 +175,7 @@ if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
173175
add_to_path "$config_file" "export PATH=$INSTALL_DIR:\$PATH"
174176
;;
175177
*)
178+
export PATH=$INSTALL_DIR:$PATH
176179
print_message warning "Manually add the directory to $config_file (or similar):"
177180
print_message info " export PATH=$INSTALL_DIR:\$PATH"
178181
;;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.