Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bucket extraction and refactoring #3449

Merged
merged 56 commits into from
May 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
fe1a91e
PowerShell: Update requirement to version 5 or greater (#3330)
niheaven Apr 28, 2019
a757dea
refactor(cmd_available/Get-Command): Add Test-CommandAvailable functi…
niheaven Apr 28, 2019
f63219f
decompress(tests): Improve installation of lessmsi and innounp (#3409)
r15ch13 Apr 28, 2019
7ef4270
shim: Add '.com'-type shim (#3366)
niheaven Apr 29, 2019
e513430
refactor(core): ensure_all_installed() to Confirm-InstallationStatus(…
niheaven Apr 29, 2019
7fa8a69
checkver.ps1: Fix example parameters (#3413)
krokofant Apr 29, 2019
70d6d9c
install: Fix bug with Start-Process -Wait, exclusive to PowerShell Co…
hpsbranco Apr 29, 2019
34c26aa
Patch(decompress): Allow other args to be passthrough (#3411)
niheaven Apr 29, 2019
466c286
Sync #3419 hotfix to develop
r15ch13 Apr 30, 2019
1487e16
Sync #3423 into develop branch
r15ch13 May 1, 2019
501d4b4
refactor(decompress): Change function name casing
r15ch13 Apr 29, 2019
42e4505
refactor(core): Rename aria2 helper functions
r15ch13 Apr 29, 2019
1149402
feature(core): Add lessmsi and innounp helper functions
r15ch13 Apr 29, 2019
51c6e77
fix(install): Check if 7zip/lessmsi/innounp is installed before addin…
r15ch13 Apr 29, 2019
d3ba0b2
fix(decompress): Fix return value of extract_7zip
r15ch13 Apr 30, 2019
e162255
refactor(decompress): Use helper functions for 7zip/lessmsi/innounp
r15ch13 Apr 30, 2019
3cb37f0
refactor(core): file_path > Get-AppFilePath
r15ch13 Apr 30, 2019
010546c
refactor(core): Combine helpers to Get-HelperPath and Test-HelperInst…
r15ch13 Apr 30, 2019
f58fdaa
refactor(tests): Check checksum of TestCases.zip before extracting
r15ch13 Apr 30, 2019
83e4576
fix(core): Remove wrong parenthesis Test-Aria2Enabled and Get-AppFile…
niheaven Apr 30, 2019
f396d88
Sync #3425 hotfix to develop
r15ch13 May 1, 2019
618824e
Sync missing hotfix #3427 to develop
r15ch13 May 1, 2019
9309b52
scoop-cache: Display help on incorrect cache command (#3431)
krokofant May 6, 2019
8beffc4
Sync renaming changes to develop
r15ch13 May 6, 2019
44975dc
feature(update): Add hold/unhold command (#3444)
r15ch13 May 8, 2019
f7a9cd9
refactor(config): Move configuration handling to core.ps1
r15ch13 Mar 18, 2019
4ec576a
refactor(bin/libexec): remove config.ps1 imports
r15ch13 Mar 18, 2019
df64db0
refactor(config): Fix config value removing
r15ch13 Mar 18, 2019
8ead07f
refactor(alias): Apply config changes to scoop-alias command
r15ch13 Mar 18, 2019
2749104
refactor(core): Prefer $XDG_CONFIG_HOME over ~\.config
niheaven Mar 18, 2019
f1c4a6c
refactor(core): Use ASCII encoding because of PowerShell 5
niheaven Mar 18, 2019
e9004e1
refactor(core): ensure config path exists
niheaven Mar 18, 2019
445d4fd
refactor(core): Remove hard-coded path
r15ch13 Mar 18, 2019
1e1a806
refactor(config): Fix set_config function
r15ch13 Mar 18, 2019
40d83d9
refactor(config): Add more tests for load_config and get_config
r15ch13 Mar 18, 2019
1e19829
refactor(config): Fix set_config
r15ch13 Mar 18, 2019
7e40e2e
refactor(config): Fix warning message
r15ch13 Mar 18, 2019
c9fa59d
fix(config): fix set_config check for existing property
r15ch13 Mar 25, 2019
8dd68f6
fix(config): fix datetime tests for PowerShell 6
r15ch13 Mar 25, 2019
d17b4e5
fix(config): Test for DateTime object instead for actual Time
r15ch13 Mar 25, 2019
630ba04
fix(config): More tests for set_config
r15ch13 Mar 25, 2019
9f4bc2a
refactor(config): Better output for scoop config command
r15ch13 Mar 25, 2019
fcabada
refactor(config): Redirect set_config output to Out-Null
r15ch13 May 9, 2019
7699bea
fix(config): Remove config.ps1 imports
r15ch13 May 9, 2019
f53ffc6
feat: support loading basedirs from config
May 10, 2019
ee7d22a
refactor: move core bootstrapper to the eof
May 10, 2019
89558f4
refactor(core): remove old scoopdir support
May 10, 2019
16f88ee
Main bucket moved to github.com/ScoopInstaller/Main
r15ch13 May 11, 2019
5d5c7fa
fix(core): Filter null or empty string from Scoops directory settings
r15ch13 May 11, 2019
27afed0
feature(decompress): Add Expand-DarkArchive helper function
r15ch13 May 11, 2019
039d591
feature(core): Allow wixtoolset and 7zip-zstd as valid helpers
r15ch13 May 11, 2019
f578cd0
feature(checkup): Add warnings to 'scoop checkup' for missing unpackers
r15ch13 May 11, 2019
2aec0b2
feature(depends): Detect dependencies from pre/post and installer script
r15ch13 May 11, 2019
8463119
fix(checkup): Remove lessmsi and aria2 from scoop checkup command
r15ch13 May 11, 2019
17253e4
Add Expand-DarkArchive and some other dependency features (#3450)
r15ch13 May 12, 2019
d006fb9
fix(update): Rewording PowerShell update notice
r15ch13 May 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(alias): Apply config changes to scoop-alias command
  • Loading branch information
r15ch13 committed May 10, 2019
commit 8ead07ffee07901fbac974625ece26f9b8dfcc2f
112 changes: 57 additions & 55 deletions libexec/scoop-alias.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,85 +30,87 @@ param(
$script:config_alias = "alias"

function init_alias_config {
$aliases = get_config $script:config_alias
if(!$aliases) {
$aliases = @{}
}
$aliases = get_config $script:config_alias
if(!$aliases) {
$aliases = @{}
}

$aliases
return $aliases
}

function add_alias($name, $command) {
if(!$command) {
abort "Can't create an empty alias."
}
if(!$command) {
abort "Can't create an empty alias."
}

# get current aliases from config
$aliases = init_alias_config
if($aliases.containskey($name)) {
abort "Alias $name already exists."
}
# get current aliases from config
$aliases = init_alias_config
if($aliases.$name) {
abort "Alias $name already exists."
}

$alias_file = "scoop-$name"
$alias_file = "scoop-$name"

# generate script
$shimdir = shimdir $false
$script =
# generate script
$shimdir = shimdir $false
$script =
@"
# Summary: $description
$command
"@
$script | out-file "$shimdir\$alias_file.ps1" -encoding utf8
$script | out-file "$shimdir\$alias_file.ps1" -encoding utf8

# add alias to config
$aliases += @{ $name = $alias_file }
set_config $script:config_alias $aliases
# add alias to config
$aliases | Add-Member -MemberType NoteProperty -Name $name -Value $alias_file

set_config $script:config_alias $aliases
}

function rm_alias($name) {
$aliases = init_alias_config
if(!$name) {
abort "Which alias should be removed?"
}
$aliases = init_alias_config
if(!$name) {
abort "Which alias should be removed?"
}

if($aliases.containskey($name)) {
"Removing alias $name..."
if($aliases.$name) {
"Removing alias $name..."

rm_shim $aliases.get_item($name) (shimdir $false)
rm_shim $aliases.$name (shimdir $false)

$aliases.remove($name)
set_config $script:config_alias $aliases
}
else { abort "Alias $name doesn't exist." }
$aliases.PSObject.Properties.Remove($name)
set_config $script:config_alias $aliases
} else {
abort "Alias $name doesn't exist."
}
}

function list_aliases {
$aliases = @()

(init_alias_config).GetEnumerator() | ForEach-Object {
$content = Get-Content (command_path $_.name)
$command = ($content | Select-Object -Skip 1).Trim()
$summary = (summary $content).Trim()

$aliases += New-Object psobject -Property @{Name=$_.name; Summary=$summary; Command=$command}
}

if(!$aliases.count) {
warn "No aliases founds."
}
$aliases = $aliases.GetEnumerator() | Sort-Object Name
if($verbose) {
return $aliases | Select-Object Name, Command, Summary | Format-Table -autosize -wrap
} else {
return $aliases | Select-Object Name, Command | Format-Table -autosize -hidetablehead -wrap
}
$aliases = @()

(init_alias_config).PSObject.Properties.GetEnumerator() | ForEach-Object {
$content = Get-Content (command_path $_.Name)
$command = ($content | Select-Object -Skip 1).Trim()
$summary = (summary $content).Trim()

$aliases += New-Object psobject -Property @{Name=$_.name; Summary=$summary; Command=$command}
}

if(!$aliases.count) {
warn "No aliases founds."
}
$aliases = $aliases.GetEnumerator() | Sort-Object Name
if($verbose) {
return $aliases | Select-Object Name, Command, Summary | Format-Table -autosize -wrap
} else {
return $aliases | Select-Object Name, Command | Format-Table -autosize -hidetablehead -wrap
}
}

switch($opt) {
"add" { add_alias $name $command }
"rm" { rm_alias $name }
"list" { list_aliases }
default { my_usage; exit 1 }
"add" { add_alias $name $command }
"rm" { rm_alias $name }
"list" { list_aliases }
default { my_usage; exit 1 }
}

exit 0