Add example of ZeroMQ
This commit is contained in:
parent
e02ab48e51
commit
3528a28127
4 changed files with 254 additions and 0 deletions
47
bin/pkg
47
bin/pkg
|
|
@ -1,3 +1,50 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
# Simple Ruby package manager mock
|
||||
# Supports:
|
||||
# pkg --user install nvim
|
||||
# pkg --system install nvim
|
||||
# pkg install nvim # defaults to --package
|
||||
# pkg --package install nvim
|
||||
|
||||
require "package"
|
||||
|
||||
puts "Welcome to package manager"
|
||||
|
||||
# Extract options and commands from arguments
|
||||
args = ARGV.dup
|
||||
|
||||
scope = :package # default
|
||||
if args.first&.start_with?("--")
|
||||
case args.shift
|
||||
when "--user"
|
||||
scope = :user
|
||||
when "--system"
|
||||
scope = :system
|
||||
when "--package"
|
||||
scope = :package
|
||||
else
|
||||
puts "Unknown option: #{args.first}"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
command = args.shift
|
||||
package = args.shift
|
||||
|
||||
if command.nil?
|
||||
puts "Usage: pkg [--user|--system|--package] <install|make> <package>"
|
||||
exit 1
|
||||
end
|
||||
|
||||
case command
|
||||
when "install"
|
||||
Package.install(package, scope)
|
||||
when "make"
|
||||
Package.make(package, scope)
|
||||
when "daemon"
|
||||
Package.daemon
|
||||
else
|
||||
puts "Unknown command: #{command}"
|
||||
exit 1
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue