mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-02-23 02:02:01 +00:00
add 'rename' command
This commit is contained in:
parent
a39e08db12
commit
87ffa78ccc
@ -30,6 +30,12 @@ def parse_args():
|
|||||||
'remove', help='remove calendar')
|
'remove', help='remove calendar')
|
||||||
parser_remove.add_argument(
|
parser_remove.add_argument(
|
||||||
'id', action='store', help='calendar id to remove')
|
'id', action='store', help='calendar id to remove')
|
||||||
|
parser_rename = command_subparsers.add_parser(
|
||||||
|
'rename', help='rename calendar')
|
||||||
|
parser_rename.add_argument(
|
||||||
|
'id', action='store', help='calendar id')
|
||||||
|
parser_rename.add_argument(
|
||||||
|
'summary', action='store', help='new summary')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.command is None:
|
if args.command is None:
|
||||||
@ -68,6 +74,10 @@ def remove_calendar(service, id):
|
|||||||
calendar.delete()
|
calendar.delete()
|
||||||
print('removed: {}'.format(id))
|
print('removed: {}'.format(id))
|
||||||
|
|
||||||
|
def rename_calendar(service, id, summary):
|
||||||
|
calendar = {'summary': summary}
|
||||||
|
service.calendars().patch(body=calendar, calendarId=id).execute()
|
||||||
|
print('{}: {}'.format(summary, id))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
@ -87,6 +97,8 @@ def main():
|
|||||||
add_owner(service, args.id, args.owner_email)
|
add_owner(service, args.id, args.owner_email)
|
||||||
elif 'remove' == args.command:
|
elif 'remove' == args.command:
|
||||||
remove_calendar(service, args.id)
|
remove_calendar(service, args.id)
|
||||||
|
elif 'rename' == args.command:
|
||||||
|
rename_calendar(service, args.id, args.summary)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user