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

add papertrail-systems command to list systems #98

Open
samuelcolvin opened this issue Jan 4, 2018 · 1 comment
Open

add papertrail-systems command to list systems #98

samuelcolvin opened this issue Jan 4, 2018 · 1 comment

Comments

@samuelcolvin
Copy link

samuelcolvin commented Jan 4, 2018

currently I'm using

papertrail-systems() {
    curl -s -H "X-Papertrail-Token: `cat ~/.papertrail.yml | sed -r 's/token://'`" https://papertrailapp.com/api/v1/systems.json | python -m json.tool | grep '"name":' | sed -r 's/ +"name": "(.*)",/\1/'
}

in my .bashrc file.

But it was a faff to setup, would be greate if there was a simpler way of getting this.

@bobpaul
Copy link

bobpaul commented Jul 18, 2020

I agree it should be added. But here it is using jq to parse json and yj to convert yml to json (so it can be parsed with jq). While less portable, it's a tad more elegant then regex:

papertrail-systems() {                                                                              
    curl -s -H "X-Papertrail-Token: `cat ~/.papertrail.yml | yj | jq --raw-output .token`" https://papertrailapp.com/api/v1/systems.json | jq --raw-output .[].name
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants