You are not logged in.

#1 2010-04-24 17:37:07

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

iwant -- blitz fast pacman wrapper

Here's a pacman front-end I use.

The syntax is:
i want vim
#or
i want vim!
#or
i need vim.
#or
i need vim, emacs and gedit!
etc.

Whatever suits you best.

It's still beta, so some advanced features might not work. Here's the source code:

#!/usr/bin/env ruby
(puts('what?');exit(1)) unless (ARGV[0] && ARGV[1] && %w[want need].include?(ARGV[0].downcase))
system "sudo pacman -S #{ARGV[1..-1].join(' ').gsub(/[,!\.]|\band\b/, ' ')}"

EDIT: Of course, save it as i somewhere in your $PATH

Last edited by JezdziecBezNicka (2010-04-25 09:13:01)


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

#2 2010-04-24 18:43:51

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: iwant -- blitz fast pacman wrapper

What if the system is root only?


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#3 2010-04-24 19:31:26

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: iwant -- blitz fast pacman wrapper

Fantastic, I say.

Offline

#4 2010-04-26 13:31:29

mar77i
Member
Registered: 2009-02-16
Posts: 21

Re: iwant -- blitz fast pacman wrapper

I don't get your script except that it does the same as pacman... And it needs to load ruby.

This I have in my ~/.bashrc , which actually saves me re- and typing of stuff...

# pacman wrapper with wait and auto-sudo
pacman() {
    if [[ -f /var/lib/pacman/db.lck ]]; then
        if pgrep pacman >/dev/null; then
            echo "error: pacman seems to be running. waiting..." >&2
            while [[ -f /var/lib/pacman/db.lck ]]; do
                sleep 1
            done
        fi
    fi
    if [[ $1 =~ ^-(S[yuc]+|Rd)$ || $1 == -[SRU] ]]; then
        sudo pacman "$@"
    else
        $(which pacman) "$@"  
    fi
}

<rickh> f(Arch) = ((Gentoo - Compiletime) + (Slackware + Depency resolution and Downloading))

Offline

#5 2010-04-26 20:41:30

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

Re: iwant -- blitz fast pacman wrapper

mar77i wrote:

I don't get your script except that it does the same as pacman... And it needs to load ruby

I was at a party and it was intended as a joke (felt funny back then:)


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

#6 2010-04-26 20:49:42

evr
Arch Linux f@h Team Member
Registered: 2009-01-23
Posts: 554

Re: iwant -- blitz fast pacman wrapper

feature request:

'i can haz vim?' should reference 'pacman -Ss vim'


btw, i've never been to a party where i ended up writing a pacman wrapper smile

Offline

#7 2010-04-26 21:02:57

Hiato
Member
Registered: 2009-01-21
Posts: 76

Re: iwant -- blitz fast pacman wrapper

Let me just say that this is, by far, the best pacman wrapper evar!

I suggest, on top of the 'i can haz', a 'i don't want' or some such:

i want more!
i don't need less.
i can haz most?

Last edited by Hiato (2010-04-26 21:03:52)

Offline

#8 2010-04-26 21:48:15

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

Re: iwant -- blitz fast pacman wrapper

don't want inspired me.

#!/usr/bin/env ruby
exit(1) if (ARGV.empty?)
pacman = lambda do |pac_arg|
  system "sudo pacman #{pac_arg} #{$'.gsub(/[,!\.]|\band\b/, ' ')}"
end
case ARGV.join(' ')
when /^(want|need|like)/, /^would love to have/
  pacman.call('-S')
when /^dont (want|need)/
  pacman.call('-R')
when /^(really|definitively) dont (want|need)/, /^insist that you remove/, /^hate/, /^despise/
  pacman.call('-Rc')
when /^am looking for/
  pacman.call('-Ss')
else
  exit(1)
end

Now you can say: i insist that you remove kde! or i despise gnomesmile

I wonder if I'll get tgn'd for this... smile

Last edited by JezdziecBezNicka (2010-04-26 21:50:13)


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

#9 2010-04-26 21:55:23

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: iwant -- blitz fast pacman wrapper

Does it work in root only?


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#10 2010-04-26 21:58:28

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

Re: iwant -- blitz fast pacman wrapper

I guess, if you have sudo installed...


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

#11 2010-04-26 22:01:02

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: iwant -- blitz fast pacman wrapper

no sudo just root


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#12 2010-04-26 22:02:54

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

Re: iwant -- blitz fast pacman wrapper

Then I guess not. Though you could just remove 'sudo' from line 4 of the script smile


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

#13 2010-04-26 23:31:21

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: iwant -- blitz fast pacman wrapper

I'll try that....................


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

Board footer

Powered by FluxBB