byteface / sharpshooter

A shorthand for creating files and folders. (A parser could be written in any language)
MIT License
11 stars 1 forks source link

- root safety check #12

Open github-actions[bot] opened 3 years ago

github-actions[bot] commented 3 years ago

This issue was automatically created by a github action that converts project Todos to issues.

https://github.com/byteface/sharpshooter/blob/e86df1cc46e23957f5ee44c4d07bb1ff1b70a91a/sharpshooter/__init__.py#L326

        self.is_root = True
        self.delete = False
        self.is_extra = False

        # This allows us to have multiple root dirs/files
        # NOTE - not sure if this is best way. But it took a while to get to this point. (or to understand why it has to be this way)
        # basically. lines with spaces cause flags to be set, however if there's no space, no flags get checked
        # so for tree to have multiple root paths. we need to know if the oncoming line is a dir or file.
        # so if next char is not a space reset the tab count and depth
        if t.lexer.lexdata[t.lexer.lexpos] != " ":
            self.tab_count = 0
            self.depth = 0
            # note - we may have to reset more than just that. (keep an eye on this)

        # TODO - root safety check
        # really should never allow cwd to be lower than root

    def t_TILDE(self, t):
        r"\~"