Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ To automatically install and use a version, run `solc-select use <version> --alw

## Usage

The global version of `solc` can be set with the `solc-select use <version>` command:
By default, `solc-select` will install the most recent available Solidity file for your version. This will automatically be done when you run `solc` for the first time.

```bash
solc
```

The global version of `solc` will automatically be set to to the latest version. You can reset this with the `solc-select use <version>` command:
```
$ solc --version
solc, the solidity compiler commandline interface
Expand All @@ -35,7 +41,6 @@ $ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Linux.g++
```

Use `SOLC_VERSION` environment variable to override the global version:
```
$ solc --version
Expand All @@ -46,6 +51,14 @@ solc, the solidity compiler commandline interface
Version: 0.5.2+commit.1df8f40c.Linux.g++
```

By default, solc-select will halt if you try to use a version that you do not have installed already. Use the `--always-install` flags to bypass this.

```bash
solc-select use 0.8.1 --always-install
Installing '0.8.1'...
Version '0.8.1' installed.
```

You can list all available versions with `solc-select install`:
```
$ solc-select install
Expand All @@ -57,23 +70,6 @@ Available versions to install:
0.8.1
```

And install the one you need with `solc-select install <version>`:
```
$ solc-select install 0.8.1
Installing '0.8.1'...
Version '0.8.1' installed.
```

You can also install the latest version with `solc-select install latest`
and use the latest version with `solc-select use latest`

Display the currently installed versions:
```
$ solc-select versions
0.8.0
0.4.2 (current, set by /Users/artur/.solc-select/global-version)
```

## Getting Help

Feel free to stop by our [Slack channel](https://empirehacking.slack.com/) for help on using or extending `solc-select`.
Expand Down
3 changes: 3 additions & 0 deletions solc_select/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
upgrade_architecture,
)


# pylint: disable=too-many-branches
def solc_select() -> None:
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -84,6 +85,8 @@ def solc_select() -> None:


def solc() -> None:
if not installed_versions():
switch_global_version(version="latest", always_install=True)
res = current_version()
if res:
(version, _) = res
Expand Down
2 changes: 2 additions & 0 deletions solc_select/solc_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def get_url(version: str = "", artifact: str = "") -> (str, str):


def switch_global_version(version: str, always_install: bool) -> None:
if version == "latest":
version = get_latest_release()
if version in installed_versions():
with open(f"{SOLC_SELECT_DIR}/global-version", "w", encoding="utf-8") as f:
f.write(version)
Expand Down