GitHub Organization Tools uses a CSV file as the primary input for user and repository data.
This file contains rows representing users, and the tool maps specific columns
to fields such as user ID, GitHub username, and repository URL.
Fields
ghot uses different fields depending on the command you are using.
| Field |
Description |
Default pattern |
id |
Identifier for the user in ghot. |
{0} |
username |
The GitHub username of the user. |
{1} |
repo |
The repository name whithin the organization. |
{2} |
description |
Description of the repository. |
"" |
By default, ghot uses the colums first columns
to extract the data from the CSV file.
id,username,repo
user1,user1,user1-repo
user2,user2,user2-repo
This can be configured using Patterns through CLI options or
through your Configuration.
Patterns
You can control how ghot extracts data from the CSV using
CLI options or through your Configuration.
Patterns support:
- Positional placeholders like
{f0}, {f1}, etc. (referring to column index)
- Named placeholders like
{username}, {repo} (referring to CSV headers)
- Default values like
{expr?default} (if the expression is empty, use default)
- Filters like
lower() or words() to transform the data.
Example: Default Patterns
CSV fileid,username,repo
user1,user1,user1-repo
user2,user2,user2-repo
| Field |
Pattern |
Result |
id |
{f0} |
user1 |
username |
{f1} |
user1 |
repo |
{f2} |
user1-repo |
description |
"" |
"" |
Example: Default behaviour with named patterns
CSV fileid,username,repo
user1,user1,user1-repo
user2,user2,user2-repo
| Field |
Pattern |
Result |
id |
{id} |
user1 |
username |
{username} |
user1 |
repo |
{repo} |
user1-repo |
description |
{description?} |
"" |
Example: Create repositories from usernames
CSV fileid,username,repo
user1,user1,user1-repo
user2,user2,user2-repo
| Field |
Pattern |
Result |
repo |
{username}-repo |
user1-repo |
description |
Repository for {username} |
Repository for user1 |
Filters
Filters are used to transform the data extracted from the CSV file.
| Filter |
Description |
lower() |
Converts the string to lowercase. |
upper() |
Converts the string to uppercase. |
title() |
Converts the string to title case. |
strip() |
Removes leading and trailing whitespace from the string. |
words(index, delimiter=" ") |
Splits the string into words and returns the word at the specified index. The delimiter parameter specifies the character used to split the string (default is a space). |
replace(old, new) |
Replaces all occurrences of old with new in the string. |
remove_accents() |
Removes accents from characters in the string. |
Example: Using Filters
CSV fileid,username,repo
user1,user1,user1-repo
user2,user2,user2-repo
| Field |
Pattern |
Result |
id |
{f0.upper()} |
USER1 |
repo |
{f2.replace('-', '_')} |
user1_repo |
Example: More complex filters
CSV filename,surname,username
fizz,buzz bazz,fizzbuzz
| Field |
Pattern |
Result |
id |
{f0.lower()}.{f1.words(0).lower()} |
fizz.buzz |
username |
{f2} |
fizzbuzz |
repo |
{f1.words(0).title()}{f0.title()}-Repository |
BuzzFizz-Repository |
description |
Repository for {f0.title()} {f1.title()} |
Repository for Fizz Buzz |
Pattern Options
| Config Key |
CLI Option |
Default Value |
Description |
csv.pattern.id |
--pattern-id |
{id} |
Pattern for id field. |
csv.pattern.username |
--pattern-username |
{username} |
Pattern for username field. |
csv.pattern.repo |
--pattern-repo |
{repo} |
Pattern for repo field. |
csv.pattern.description |
--pattern-description |
"" |
Pattern for description field. |