Add help info.
This commit is contained in:
parent
1e7d5e1754
commit
66452f6983
|
@ -3,13 +3,16 @@ import sys
|
|||
import shutil
|
||||
import time
|
||||
import os
|
||||
import argparse
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python3 delete_fid.py <fid> [file_path]")
|
||||
sys.exit(1)
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Repair TSDB data by removing specified fid.')
|
||||
parser.add_argument('fid', type=int, help='The fid to be removed')
|
||||
parser.add_argument('file_path', nargs='?', default='current.json', help='The path to the JSON file (default: current.json)')
|
||||
args = parser.parse_args()
|
||||
|
||||
target_fid = int(sys.argv[1])
|
||||
file_path = sys.argv[2] if len(sys.argv) > 2 else "current.json"
|
||||
target_fid = args.fid
|
||||
file_path = args.file_path
|
||||
|
||||
# Read file content
|
||||
with open(file_path, 'r') as file:
|
||||
|
@ -38,3 +41,6 @@ with open(file_path, 'w') as file:
|
|||
json.dump(data, file, separators=(',', ':'), ensure_ascii=False)
|
||||
|
||||
print(f"Removed content with fid {target_fid}.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue