house-of-cards


Namehouse-of-cards JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA robust CLI tool to create directory structures from tree-like input.
upload_time2024-09-30 09:31:33
maintainerNone
docs_urlNone
authorYour Name
requires_python<3.13,>=3.8
licenseGPL-3.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![build](https://github.com/Ferrum-Citadel/house-of-cards/actions/workflows/python-test.yml/badge.svg)
# House-of-Cards (hoc)

A command-line tool to create real file structures on your system from tree-like representations. Easily replicate directory and file structures from your favorite articles, tutorials, LLM answers, or even from `tree -F` outputs from other users! Just copy the tree  structure to your clipboard and you're ready to recreate it on your system.

## Features

- Parses tree-like representations of file structures like:
```sh
./
├── src/
│   ├── main.py
│   └── utils.py
├── tests/
│   └── test_main.py
└── README.md
```
and creates them in your system.
- Handles directories with or without trailing slashes.
- Compatible with the output of the `tree -F` command.
- Can Automatically set appropriate permissions for directories and files.

## Installation

Install `hoc` from PyPI using `pip`:

```sh
pip install house-of-cards
```
or run it using pipx:
```sh
pipx run house-of-cards
```

or even single runs  with uvx:
```sh
uvx house-of-cards
```

## Usage

`hoc` can be used directly from the command line. It reads the file structure string from the clipboard or a file and creates the corresponding directory and file structure at the specified base path.

```sh
hoc <base_path> [options]
```
- <base_path>: The base directory where the structure will be created. (current directory if not provided)
- [Options]: Optional arguments to customize the behavior of the command.  

> [!NOTE]  
> If the dir that was chosen as base for the generated file structure does not exist it will be created.

### Options
- `-f, --file FILENAME`: File containing the tree structure. If not provided, the clipboard content will be used.
- `-dp, --dir-permissions PERMISSIONS`: Octal permissions for created directories (e.g., 755).
- `-fp, --file-permissions PERMISSIONS`: Octal permissions for created files (e.g., 644).
- `-h, --help`: Show the help message and exit.

## Examples

### Example 1: Generating a file structure from the clipboard contents
You can generate a directory structure based on the contents of your clipboard. Just copy the tree-like structure from your favorite tutorial, LLM answer, documentation or the output of a:
```sh
 `tree -F .`
 ```
  command and run hoc by just specifying the base path.

```sh
hoc /relative/base/path
```

Try it by copying the following structure to your clipboard:

```sh
etc/
├── apache2/
│   ├── apache2.conf
│   ├── envvars
│   ├── magic
│   ├── mods-available/
│   ├── mods-enabled/
│   ├── sites-available/
│   └── sites-enabled/
├── network/
│   ├── if-up.d/
│   ├── if-down.d/
│   └── interfaces
├── passwd
├── shadow
├── group
└── hosts
```
and running:
```sh
hoc ~/hoc_test
```
or
```sh
hoc 
```
If you want to use the current directory as the base path.

### Example 2: Creating a Structure from a File
Create a file named structure.txt with the following content:

```sh
./
├── apache2/
│   ├── apache2.conf
│   ├── envvars
│   ├── magic
│   ├── mods-available/
│   ├── mods-enabled/
│   ├── sites-available/
│   └── sites-enabled/
├── network/
│   ├── if-up.d/
│   ├── if-down.d/
│   └── interfaces
├── passwd
├── shadow
├── group
└── hosts
```
Run hoc to create the structure:
```sh
hoc /relative/base/path -f structure.txt
```

### Example 3: Setting Permissions
You can set the permissions for directories and files using the `-dp` and `-fp` options. For example, to set the permissions for directories to 755 and for files to 644, run:
```sh
hoc /relative/base/path -dp 755 -fp 644
```

### Example 4: Use it to clone file structures to a remote server or share them with other users
You can use hoc to clone file structures to a remote server by copying the structure using:
```sh
tree -F /path/to/directory | pbcopy
or
tree -F /path/to/directory | xclip -selection clipboard
```
and either share the clipboard content with the other user or save it to a file and send it to them. They can then run hoc on their system to create the same structure or run it on the remote server to create the structure there.

## License

This project is licensed under the GNU General Public License version 3. See the [LICENSE](LICENSE) file for details.
  

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "house-of-cards",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "your.email@example.com",
    "download_url": "https://files.pythonhosted.org/packages/31/25/2f0ed3e8e888dc47d8ba21b2271de0abc5b9219af7864571194cc33c106f/house_of_cards-1.0.1.tar.gz",
    "platform": null,
    "description": "![build](https://github.com/Ferrum-Citadel/house-of-cards/actions/workflows/python-test.yml/badge.svg)\n# House-of-Cards (hoc)\n\nA command-line tool to create real file structures on your system from tree-like representations. Easily replicate directory and file structures from your favorite articles, tutorials, LLM answers, or even from `tree -F` outputs from other users! Just copy the tree  structure to your clipboard and you're ready to recreate it on your system.\n\n## Features\n\n- Parses tree-like representations of file structures like:\n```sh\n./\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 main.py\n\u2502   \u2514\u2500\u2500 utils.py\n\u251c\u2500\u2500 tests/\n\u2502   \u2514\u2500\u2500 test_main.py\n\u2514\u2500\u2500 README.md\n```\nand creates them in your system.\n- Handles directories with or without trailing slashes.\n- Compatible with the output of the `tree -F` command.\n- Can Automatically set appropriate permissions for directories and files.\n\n## Installation\n\nInstall `hoc` from PyPI using `pip`:\n\n```sh\npip install house-of-cards\n```\nor run it using pipx:\n```sh\npipx run house-of-cards\n```\n\nor even single runs  with uvx:\n```sh\nuvx house-of-cards\n```\n\n## Usage\n\n`hoc` can be used directly from the command line. It reads the file structure string from the clipboard or a file and creates the corresponding directory and file structure at the specified base path.\n\n```sh\nhoc <base_path> [options]\n```\n- <base_path>: The base directory where the structure will be created. (current directory if not provided)\n- [Options]: Optional arguments to customize the behavior of the command.  \n\n> [!NOTE]  \n> If the dir that was chosen as base for the generated file structure does not exist it will be created.\n\n### Options\n- `-f, --file FILENAME`: File containing the tree structure. If not provided, the clipboard content will be used.\n- `-dp, --dir-permissions PERMISSIONS`: Octal permissions for created directories (e.g., 755).\n- `-fp, --file-permissions PERMISSIONS`: Octal permissions for created files (e.g., 644).\n- `-h, --help`: Show the help message and exit.\n\n## Examples\n\n### Example 1: Generating a file structure from the clipboard contents\nYou can generate a directory structure based on the contents of your clipboard. Just copy the tree-like structure from your favorite tutorial, LLM answer, documentation or the output of a:\n```sh\n `tree -F .`\n ```\n  command and run hoc by just specifying the base path.\n\n```sh\nhoc /relative/base/path\n```\n\nTry it by copying the following structure to your clipboard:\n\n```sh\netc/\n\u251c\u2500\u2500 apache2/\n\u2502   \u251c\u2500\u2500 apache2.conf\n\u2502   \u251c\u2500\u2500 envvars\n\u2502   \u251c\u2500\u2500 magic\n\u2502   \u251c\u2500\u2500 mods-available/\n\u2502   \u251c\u2500\u2500 mods-enabled/\n\u2502   \u251c\u2500\u2500 sites-available/\n\u2502   \u2514\u2500\u2500 sites-enabled/\n\u251c\u2500\u2500 network/\n\u2502   \u251c\u2500\u2500 if-up.d/\n\u2502   \u251c\u2500\u2500 if-down.d/\n\u2502   \u2514\u2500\u2500 interfaces\n\u251c\u2500\u2500 passwd\n\u251c\u2500\u2500 shadow\n\u251c\u2500\u2500 group\n\u2514\u2500\u2500 hosts\n```\nand running:\n```sh\nhoc ~/hoc_test\n```\nor\n```sh\nhoc \n```\nIf you want to use the current directory as the base path.\n\n### Example 2: Creating a Structure from a File\nCreate a file named structure.txt with the following content:\n\n```sh\n./\n\u251c\u2500\u2500 apache2/\n\u2502   \u251c\u2500\u2500 apache2.conf\n\u2502   \u251c\u2500\u2500 envvars\n\u2502   \u251c\u2500\u2500 magic\n\u2502   \u251c\u2500\u2500 mods-available/\n\u2502   \u251c\u2500\u2500 mods-enabled/\n\u2502   \u251c\u2500\u2500 sites-available/\n\u2502   \u2514\u2500\u2500 sites-enabled/\n\u251c\u2500\u2500 network/\n\u2502   \u251c\u2500\u2500 if-up.d/\n\u2502   \u251c\u2500\u2500 if-down.d/\n\u2502   \u2514\u2500\u2500 interfaces\n\u251c\u2500\u2500 passwd\n\u251c\u2500\u2500 shadow\n\u251c\u2500\u2500 group\n\u2514\u2500\u2500 hosts\n```\nRun hoc to create the structure:\n```sh\nhoc /relative/base/path -f structure.txt\n```\n\n### Example 3: Setting Permissions\nYou can set the permissions for directories and files using the `-dp` and `-fp` options. For example, to set the permissions for directories to 755 and for files to 644, run:\n```sh\nhoc /relative/base/path -dp 755 -fp 644\n```\n\n### Example 4: Use it to clone file structures to a remote server or share them with other users\nYou can use hoc to clone file structures to a remote server by copying the structure using:\n```sh\ntree -F /path/to/directory | pbcopy\nor\ntree -F /path/to/directory | xclip -selection clipboard\n```\nand either share the clipboard content with the other user or save it to a file and send it to them. They can then run hoc on their system to create the same structure or run it on the remote server to create the structure there.\n\n## License\n\nThis project is licensed under the GNU General Public License version 3. See the [LICENSE](LICENSE) file for details.\n  \n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "A robust CLI tool to create directory structures from tree-like input.",
    "version": "1.0.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6de8a0f96eb0b4c6592096f4c7cdc345847f19154efd1767e06d75816e8a404",
                "md5": "dca866b924dc5c3495f8842a0a021b18",
                "sha256": "20c517901e5a61f3cd550a8f2006a2a092b0ea7680be4aa32ebf0ffff42b71e7"
            },
            "downloads": -1,
            "filename": "house_of_cards-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dca866b924dc5c3495f8842a0a021b18",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.8",
            "size": 17755,
            "upload_time": "2024-09-30T09:31:31",
            "upload_time_iso_8601": "2024-09-30T09:31:31.781753Z",
            "url": "https://files.pythonhosted.org/packages/b6/de/8a0f96eb0b4c6592096f4c7cdc345847f19154efd1767e06d75816e8a404/house_of_cards-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "31252f0ed3e8e888dc47d8ba21b2271de0abc5b9219af7864571194cc33c106f",
                "md5": "c7e474580d4322f8866b4f8df2d006c2",
                "sha256": "82145b925201df62353f1c5458ec63d0f5593348219a777a9f4108e7b8eb64a9"
            },
            "downloads": -1,
            "filename": "house_of_cards-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c7e474580d4322f8866b4f8df2d006c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.8",
            "size": 16713,
            "upload_time": "2024-09-30T09:31:33",
            "upload_time_iso_8601": "2024-09-30T09:31:33.115771Z",
            "url": "https://files.pythonhosted.org/packages/31/25/2f0ed3e8e888dc47d8ba21b2271de0abc5b9219af7864571194cc33c106f/house_of_cards-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-30 09:31:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "house-of-cards"
}
        
Elapsed time: 0.34617s