martindstone / pagerduty-cli

A command line interface for PagerDuty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: pd incident:rename

georgettica opened this issue · comments

if you have a better way of getting the same goal. I would be glad to use that

I would love to have a way of changing the title of an incident
this is the way of team we easily label an incident, for and example:

current incident name:
ISSUE HAPPENED 
new incident name:
[Pending Customer] ISSUE HAPPENED

as seen in https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE0Mg-update-an-incident

Hi there - although Martin doesn't have a "pd incident:set" option you can use the rest parameter to easily do it. Try this...
pd rest:put -e https://api.pagerduty.com/incidents/YOURINCIDENT -d '{"incident": {"type": "incident","title": "NEW TITLE"}}'

yeah, I know the rest works, I guess I wanted to make this easier than the API call

thanks though!

I'll create a bash function that does this and note this issue..
if enough people will want it I guess we can push that change?

Thanks @jcalcada! that will definitely work (also, the https://api.pagerduty.com/ part isn't needed 😉) - I could do a dedicated incident:set command if that's helpful, there are a few things that can be set on incident besides the title, like the urgency etc...

This sounds like a great idea! We do the same things, especially when it’s a “known issue” we can’t fix right now. We use that to quickly merge cases based on our internal ticket numbers!

@sarman-tftsr I would suggest adding a 👍 to the issue, so we can track how many people want this feature

hi everyone, I just published v0.0.84 which adds:

  • incident:set (with alias incident:update) that you can use to set the title, urgency and a few other things on incidents
  • incident:rename that you can use to just set incident titles with a simpler set of flags

both commands take the usual incident selection arguments (-i, -m, -p) and can work on multiple incidents in one go. Let me know if this works for you and if so I will close this issue

it does work, my use case and @jcalcada was to add a prefix,
my work now is to do a rest:get to get the incidents name

pd incident:rename -i <ID> -t "<PREFIX> $(pd rest:get -e /incidents/<ID> | jq .incident.title)"

I thought about implementing it that way @georgettica but it would have to get every incident first so it would be more https requests... I was on the fence about it, now I think I want to do it 😂. I'll probably make that change tomorrow and push it as 0.0.85

I don't see an issue with having more requests if it minimizes users overhead

I am thinking to have a separate flag to prefix a given string to the existing title... later on maybe I will mess around with regexps too

I think an additional flag would be perfect

Hi so I just published 0.0.85 which adds the --prefix flag and just prepends the given string to the incident title... let me know how you make out with it...

I tried it now at last and it works great, thanks!