@@ -164,8 +164,6 @@ construct_download_url() {
164164}
165165
166166install_env=APIFY_CLI_INSTALL
167- bin_env=\$ $install_env /bin
168-
169167install_dir=${! install_env:- $HOME / .apify}
170168bin_dir=$install_dir /bin
171169
@@ -178,7 +176,9 @@ for executable_name in "${executable_names[@]}"; do
178176 download_url=$( construct_download_url " $executable_name " " $target " )
179177 output_filename=" ${executable_name} "
180178
181- curl --fail --location --progress-bar --output " $bin_dir /$output_filename " " $download_url " 2> /dev/null ||
179+ info " Downloading $executable_name bundle for version $version and target $target "
180+
181+ curl --fail --location --progress-bar --output " $bin_dir /$output_filename " " $download_url " ||
182182 error " Failed to download $executable_name bundle for version $version and target $target (might not exist for this platform/arch combination)"
183183
184184 chmod +x " $bin_dir /$output_filename " ||
@@ -200,161 +200,8 @@ tildify() {
200200 fi
201201}
202202
203- success " Apify CLI was installed successfully to $Bold_Green $( tildify " $bin_dir /apify" ) "
204- success " Actor CLI was installed successfully to $Bold_Green $( tildify " $bin_dir /actor" ) "
205-
206- if command -v apify > /dev/null; then
207- success " Run 'apify --help' to get started"
208- exit
209- fi
210-
211- refresh_command=' '
212-
213- tilde_bin_dir=$( tildify " $bin_dir " )
214- quoted_install_dir=\" ${install_dir// \" / \\\" } \"
215-
216- if [[ $quoted_install_dir = \" $HOME /* ]]; then
217- quoted_install_dir=${quoted_install_dir/ $HOME \/ / \$ HOME/ }
218- fi
219-
220- if [[ -d $HOME /.local/bin ]]; then
221- # First, remove the symlinks if they exist
222- rm -f $HOME /.local/bin/apify
223- rm -f $HOME /.local/bin/actor
224- rm -f $HOME /.local/bin/apify-cli
225-
226- # Symlink the three executables to /usr/local/bin
227- ln -s " $bin_dir /apify" $HOME /.local/bin/apify
228- ln -s " $bin_dir /actor" $HOME /.local/bin/actor
229- ln -s " $bin_dir /apify-cli" $HOME /.local/bin/apify-cli
230-
231- info " Symlinked apify, actor, and apify-cli to $HOME /.local/bin"
232- fi
233-
234- echo
235-
236- case $( basename " $SHELL " ) in
237- fish)
238- commands=(
239- " set --export $install_env $quoted_install_dir "
240- " set --export PATH $bin_env \$ PATH"
241- )
242-
243- fish_config=$HOME /.config/fish/config.fish
244- tilde_fish_config=$( tildify " $fish_config " )
245-
246- if [[ -w $fish_config ]]; then
247- {
248- echo -e ' \n# apify cli'
249-
250- for command in " ${commands[@]} " ; do
251- echo " $command "
252- done
253- } >> " $fish_config "
254-
255- info " Added \" $tilde_bin_dir \" to \$ PATH in \" $tilde_fish_config \" "
256-
257- refresh_command=" source $tilde_fish_config "
258- else
259- echo " Manually add the directory to $tilde_fish_config (or similar):"
260-
261- for command in " ${commands[@]} " ; do
262- info_bold " $command "
263- done
264- fi
265- ;;
266- zsh)
267- commands=(
268- " export $install_env =$quoted_install_dir "
269- " export PATH=\" $bin_env :\$ PATH\" "
270- )
271-
272- zsh_config=$HOME /.zshrc
273- tilde_zsh_config=$( tildify " $zsh_config " )
274-
275- if [[ -w $zsh_config ]]; then
276- {
277- echo -e ' \n# apify cli'
278-
279- for command in " ${commands[@]} " ; do
280- echo " $command "
281- done
282- } >> " $zsh_config "
283-
284- info " Added \" $tilde_bin_dir \" to \$ PATH in \" $tilde_zsh_config \" "
285-
286- refresh_command=" exec $SHELL "
287- else
288- echo " Manually add the directory to $tilde_zsh_config (or similar):"
289-
290- for command in " ${commands[@]} " ; do
291- info_bold " $command "
292- done
293- fi
294- ;;
295- bash)
296- commands=(
297- " export $install_env =$quoted_install_dir "
298- " export PATH=\" $bin_env :\$ PATH\" "
299- )
300-
301- bash_configs=(
302- " $HOME /.bashrc"
303- " $HOME /.bash_profile"
304- )
305-
306- if [[ ${XDG_CONFIG_HOME:- } ]]; then
307- bash_configs+=(
308- " $XDG_CONFIG_HOME /.bash_profile"
309- " $XDG_CONFIG_HOME /.bashrc"
310- " $XDG_CONFIG_HOME /bash_profile"
311- " $XDG_CONFIG_HOME /bashrc"
312- )
313- fi
314-
315- set_manually=true
316- for bash_config in " ${bash_configs[@]} " ; do
317- tilde_bash_config=$( tildify " $bash_config " )
318-
319- if [[ -w $bash_config ]]; then
320- {
321- echo -e ' \n# apify cli'
322-
323- for command in " ${commands[@]} " ; do
324- echo " $command "
325- done
326- } >> " $bash_config "
327-
328- info " Added \" $tilde_bin_dir \" to \$ PATH in \" $tilde_bash_config \" "
329-
330- refresh_command=" source $bash_config "
331- set_manually=false
332- break
333- fi
334- done
335-
336- if [[ $set_manually = true ]]; then
337- echo " Manually add the directory to $tilde_bash_config (or similar):"
338-
339- for command in " ${commands[@]} " ; do
340- info_bold " $command "
341- done
342- fi
343- ;;
344- * )
345- echo ' Manually add the directory to ~/.bashrc (or similar):'
346- info_bold " export $install_env =$quoted_install_dir "
347- info_bold " export PATH=\" $bin_env :\$ PATH\" "
348- ;;
349- esac
350-
351- echo
352- info " To get started, run:"
353- echo
354-
355- if [[ $refresh_command ]]; then
356- info_bold " $refresh_command $( info " (if the shell is not automatically refreshed)" ) "
357- fi
203+ success " Apify and Actor CLI $version were installed successfully!"
204+ info " The binaries are located at $Bold_Green $( tildify " $bin_dir /apify" ) ${Dim} and $Bold_Green $( tildify " $bin_dir /actor" ) "
358205
359- info_bold " apify --help "
360- echo
206+ # Invoke the CLI to handle shell integrations nicely
207+ PROVIDED_INSTALL_DIR= " $install_dir " FINAL_BIN_DIR= " $bin_dir " " $bin_dir /apify " install
0 commit comments