_npus: Split out of lrzip for general use.
This commit is contained in:
parent
3f851722d7
commit
22dff29dc4
@ -888,6 +888,14 @@ _available_interfaces()
|
|||||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Echo number of CPUs, falling back to 1 on failure.
|
||||||
|
_ncpus()
|
||||||
|
{
|
||||||
|
local var=NPROCESSORS_ONLN
|
||||||
|
[[ $OSTYPE == *linux* ]] && var=_$var
|
||||||
|
local n=$( getconf $var 2>/dev/null )
|
||||||
|
printf %s ${n:-1}
|
||||||
|
}
|
||||||
|
|
||||||
# Perform tilde (~) completion
|
# Perform tilde (~) completion
|
||||||
# @return True (0) if completion needs further processing,
|
# @return True (0) if completion needs further processing,
|
||||||
|
@ -35,10 +35,7 @@ _lrzip()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-p)
|
-p)
|
||||||
local var=NPROCESSORS_ONLN
|
COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) )
|
||||||
[[ $OSTYPE == *linux* ]] && var=_$var
|
|
||||||
local n=$( getconf $var 2>/dev/null )
|
|
||||||
COMPREPLY=( $( compgen -W "{1..${n:-1}}" -- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user