Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index_updater.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env python3

#importing modules
import sys
import os
#all of these modules are in-built

# Terminal parameters.
if len(sys.argv[1:]) == 0:
Expand All @@ -21,8 +23,8 @@

# If we have files, write "index.md"
if curr_files:
with open(os.path.join(root, 'index.md'), mode='w') as md_file:
with open(os.path.join(root, 'index.md'), mode='w') as md_file: #opining the file in write mode
md_file.write('# Index of {}\n\n'.format(curr_folder))
for line in curr_files:
file_name = line.split('.')[0].replace('_',' ').title()
md_file.write('* [' + file_name + '](' +line + ')\n')
md_file.write('* [' + file_name + '](' +line + ')\n') # \n is for going to next line