scanner: Decouple __main__ from library

For packaging in the future.
indexer: Decouple __main__ from library

For packaging in the future.