Let delete_channel use pipeable to support !c, !i.

This commit is contained in:
voussoir 2021-10-25 13:21:28 -07:00
parent d08415eaad
commit 21dcf6a6b1
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -53,7 +53,7 @@ def channel_list_argparse(args):
def delete_channel_argparse(args): def delete_channel_argparse(args):
ycdldb = closest_db() ycdldb = closest_db()
for channel_id in args.channel_id: for channel_id in pipeable.input_many(args.channel_ids):
channel = ycdldb.get_channel(channel_id) channel = ycdldb.get_channel(channel_id)
channel.delete() channel.delete()
@ -161,12 +161,14 @@ delete_channel:
Delete a channel and all its videos from the database. Delete a channel and all its videos from the database.
You can pass multiple channel IDs. You can pass multiple channel IDs.
Uses pipeable to support !c clipboard, !i stdin.
> ycdl_cli.py delete_channel channel_id [channel_id channel_id] > ycdl_cli.py delete_channel channel_id [channel_id channel_id...]
Examples: Examples:
> ycdl_cli.py delete_channel UCOYBuFGi8T3NM5fNAptCLCw > ycdl_cli.py delete_channel UCOYBuFGi8T3NM5fNAptCLCw
> ycdl_cli.py delete_channel UCOYBuFGi8T3NM5fNAptCLCw UCmu9PVIZBk-ZCi-Sk2F2utA UCEKJKJ3FO-9SFv5x5BzyxhQ > ycdl_cli.py delete_channel UCOYBuFGi8T3NM5fNAptCLCw UCmu9PVIZBk-ZCi-Sk2F2utA
> ycdl_cli.py channel_list --format {id} | ycdl_cli.py delete_channel !i
'''.strip(), '''.strip(),
init=''' init='''
@ -218,7 +220,7 @@ def main(argv):
p_channel_list.set_defaults(func=channel_list_argparse) p_channel_list.set_defaults(func=channel_list_argparse)
p_delete_channel = subparsers.add_parser('delete_channel', aliases=['delete-channel']) p_delete_channel = subparsers.add_parser('delete_channel', aliases=['delete-channel'])
p_delete_channel.add_argument('channel_id', nargs='+') p_delete_channel.add_argument('channel_ids', nargs='+')
p_delete_channel.add_argument('--yes', dest='autoyes', action='store_true') p_delete_channel.add_argument('--yes', dest='autoyes', action='store_true')
p_delete_channel.set_defaults(func=delete_channel_argparse) p_delete_channel.set_defaults(func=delete_channel_argparse)