Skip to content

[ BUG ] --indent argument makes the script crashed #131

@qq88976321

Description

@qq88976321

Describe the bug
--indent <NUM> makes the script crashed. (Especially when there are following arguments.)

To Reproduce

$ cat README.md
# Title 1
<!--ts-->
<!--te-->
## Title 2

$ gh-md-toc --indent 2 --insert --no-backup README.md
rm: unrecognized option '--insert~~'
Try 'rm --help' for more information.
Parsing local markdown file requires access to github API
Please make sure curl is installed and check your network connectivity

Expected behavior
Insert TOC with corresponding indent. e.g.,

$ cat README.md
# Title 1
<!--ts-->
<!--te-->
## Title 2

$ gh-md-toc --indent 2 --insert --no-backup README.md

Table of Contents
=================

* [Title 1](#title-1)
  * [Title 2](#title-2)
Found markers

!! TOC was added into: 'README.md'


<!-- Created by https://github.com/ekalinin/github-markdown-toc -->

$ cat README.md
# Title 1
<!--ts-->
* [Title 1](#title-1)
  * [Title 2](#title-2)

<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
<!-- Added by: qq88976321, at: Tue 03 May 2022 01:09:46 AM CST -->

<!--te-->
## Title 2

Environment (please complete the following information):

  • OS: Ubuntu 20.04.3 LTS
  • Version: master branch (a261661)

Additional context
It is likely that an error occurred while parsing the indent argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions