Skip to content

Commit

Permalink
refactor: Remove common.nu (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer authored Nov 11, 2024
1 parent 1c76cf1 commit 9b1d4c7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 117 deletions.
115 changes: 0 additions & 115 deletions nu/common.nu

This file was deleted.

31 changes: 29 additions & 2 deletions nu/moonbit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# setup moonbit
# setup moonbit 0.1.20240910+3af041b9a

use common.nu [hr-line windows? is-installed]

const CLI_HOST = 'https://cli.moonbitlang.com'

const ARCH_TARGET_MAP = {
Expand Down Expand Up @@ -133,4 +131,33 @@ def bundle-core [coreDir: string] {
}
}

# If current host is Windows
export def windows? [] {
# Windows / Darwin / Linux
(sys host | get name) == 'Windows'
}

# Check if some command available in current shell
export def is-installed [ app: string ] {
(which $app | length) > 0
}

export def hr-line [
width?: int = 90,
--color(-c): string = 'g',
--blank-line(-b),
--with-arrow(-a),
] {
# Create a line by repeating the unit with specified times
def build-line [
times: int,
unit: string = '-',
] {
0..<$times | reduce -f '' { |i, acc| $unit + $acc }
}

print $'(ansi $color)(build-line $width)(if $with_arrow {'>'})(ansi reset)'
if $blank_line { char nl }
}

alias main = setup moonbit

0 comments on commit 9b1d4c7

Please sign in to comment.