Files
vim-ale/flutter/install.sh
2020-06-17 20:33:07 -06:00

31 lines
972 B
Bash

#!/bin/bash
set -e
set -u
# NOTE: pkg_* variables can be defined here
# pkg_cmd_name
# pkg_src, pkg_src_bin, pkg_src_cmd
# pkg_dst, pkg_dst_bin, pkg_dst_cmd
#
# Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages
pkg_cmd_name="flutter"
pkg_get_current_version() {
# 'flutter --version' outputs a lot of information:
# Flutter 1.19.0-4.1.pre • channel beta • https://github.com/flutter/flutter.git
# Framework • revision f994b76974 (4 days ago) • 2020-06-09 15:53:13 -0700
# Engine • revision 9a28c3bcf4
# Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)
# This trims it down to just the version number:
# 1.19.0-4.1.pre
echo "$(flutter --version 2>/dev/null | head -n 1 | cut -d' ' -f2)"
}
pkg_format_cmd_version() {
# 'flutter 1.19.0' is the canonical version format for flutter
my_version="$1"
echo "$pkg_cmd_name $my_version"
}