diff --git a/fcl b/fcl index 653d335..8806975 100755 --- a/fcl +++ b/fcl @@ -16,7 +16,7 @@ # DEFAULT_ORG = "buildkite" -REPO_BASE = "#{ENV['HOME']}/repos" +REPO_BASE = "#{ENV['HOME']}/src" def clone(repo_url, destination) spinner_command = %Q[gum spin --show-output --spinner dot] @@ -24,7 +24,7 @@ def clone(repo_url, destination) system("#{spinner_command} -- #{git_command}") end -def print_error(message) +def log_error(message) system(%Q[gum style --bold --border=double --padding='0 1' --foreground 212 "#{message}"]) end @@ -66,10 +66,12 @@ def destination_path(repo_str) File.join(forge, org, repo) end -destination = ARGV[1] || destination_path(ARGV[0]) +repo_str = ARGV.empty? ? `gum input --header="Enter a repo name" --placeholder=""`.chomp : ARGV[0] + +destination = ARGV[1] || destination_path(repo_str) full_dest = File.join(REPO_BASE, destination) -clone_url = repo_url(ARGV[0]) +clone_url = repo_url(repo_str) if Dir.exist?(full_dest) log_error "#{destination} already exists. Doing nothing."