You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples/python.rst
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,16 +26,17 @@ Creating a script
26
26
Lets create a `test_installer` - installer as an example. This is assuming that the folder `./archinstall` is a git-clone of the main repo.
27
27
We begin by creating "`scripts`_:code:`/test_installer.py`". The placement here is important later.
28
28
29
-
This script can now already be called using :code:`python -m archinstall test_installer` after a successful installation of the library itself.
29
+
This script can now already be called using :code:`python -m archinstall --script test_installer` after a successful installation of the library itself.
30
30
But the script won't do much. So we'll do something simple like list all the hard drives as an example.
31
31
32
32
To do this, we'll begin by importing :code:`archinstall` in our "`scripts`_:code:`/test_installer.py`" and call a function whtin ``archinstall``.
33
33
34
34
.. code-block:: python
35
35
36
-
import archinstall
36
+
from archinstall.lib.disk.device_handler import device_handler
37
+
from pprint import pprint
37
38
38
-
print(archinstall.disk.device_handler.devices)
39
+
pprint(device_handler.devices)
39
40
40
41
Now, go ahead and reference the :ref:`installing.python.manual` installation method.
41
42
After running ``python -m archinstall test_installer`` it should print something that looks like:
0 commit comments