Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewboltachev authored Nov 17, 2022
1 parent 07b4539 commit 878b034
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,49 @@ Installation

1. Clone this repo:

git clone
```
git clone https://github.com/andrewboltachev/mega-copy.git
```

2. Create a helper script to run the tool (e.g. `~/bin/mega-copy.sh`):
```
mkvirtualenv # (or venv)
```
```bash
/home/andrey/.virtualenvs/mega-copy/bin/python /home/myuser/mega-copy/mega-copy.py $@
```

2. Suppose you want to refactor your Python code, replacing something called "property sale" to something else named "sales order". Run:
```
> mega.copy.sh show property-sale sales-order
```

The tool will generate the following "replace map" (taking into account all possible spellings):
```python
{
"propertysale": "salesorder",
"property sale": "sales order",
"property-sale": "sales-order",
"property_sale": "sales_order",
"PROPERTYSALE": "SALESORDER",
"PROPERTY SALE": "SALES ORDER",
"PROPERTY-SALE": "SALES-ORDER",
"PROPERTY_SALE": "SALES_ORDER",
"PropertySale": "SalesOrder",
"Property Sale": "Sales Order",
"Property-Sale": "Sales-Order",
"Property_Sale": "Sales_Order",
"Propertysale": "Salesorder",
"Property sale": "Sales order",
"Property-sale": "Sales-order",
"Property_sale": "Sales_order",
"propertySale": "salesOrder",
"property Sale": "sales Order",
"property-Sale": "sales-Order",
"property_Sale": "sales_Order"
}
```

and below show all code expressions affected by it in code (your current directory)

Instead of `show` you can then use another command — `ren`, to rename all occurencies in the code in-place

0 comments on commit 878b034

Please sign in to comment.