@click.command()<EOL>@click.argument(<EOL>'<STR_LIT>',<EOL>type=click.INT<EOL>)<EOL>@click.pass_context<EOL>def delete(context, item):
history_log = context.obj['<STR_LIT>']<EOL>no_color = context.obj['<STR_LIT>']<EOL>try:<EOL><INDENT>with open(history_log, '<STR_LIT>') as f:<EOL><INDENT>lines = f.readlines()<EOL>history = lines.pop(len(lines) - item)<EOL>f.seek(<NUM_LIT:0>)<EOL>f.write('<STR_LIT>'.join(lines))<EOL>f.flush()<EOL>f.truncate()<EOL><DEDENT><DEDENT>except IndexError:<EOL><INDENT>echo_style(<EOL>'<STR_LIT>' % item,<EOL>no_color,<EOL>fg='<STR_LIT>'<EOL>)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>except Exception as error:<EOL><INDENT>echo_style(<EOL>'<STR_LIT>'.format(item, error),<EOL>no_color,<EOL>fg='<STR_LIT>'<EOL>)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>log_file = get_log_file_from_item(history)<EOL>try:<EOL><INDENT>os.remove(log_file)<EOL><DEDENT>except Exception:<EOL><INDENT>echo_style(<EOL>'<STR_LIT>'.format(item),<EOL>no_color,<EOL>fg='<STR_LIT>'<EOL>)<EOL><DEDENT>try:<EOL><INDENT>os.remove(log_file.rsplit('<STR_LIT:.>', <NUM_LIT:1>)[<NUM_LIT:0>] + '<STR_LIT>')<EOL><DEDENT>except Exception:<EOL><INDENT>echo_style(<EOL>'<STR_LIT>'.format(item),<EOL>no_color,<EOL>fg='<STR_LIT>'<EOL>)<EOL><DEDENT>
Delete the specified history item from the history log.