Skip to content

Commit

Permalink
Merge pull request #2 from loupeteam/bugfix/viewall-cmd
Browse files Browse the repository at this point in the history
Improve robustness of viewall command
  • Loading branch information
AndrewMusser authored Dec 14, 2023
2 parents eb5f5da + c67040f commit a5ff085
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change log

- 1.0.2 - Improve robustness of viewall command

- 1.0.1 - Replace all webHMI references with Loupe UX

- 1.0.0 - Public release
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# Info
# LPM

![version badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Floupeteam%2FLPM%2Fmain%2Fsrc%2Fversion.json&query=%24.version&label=version)

This tool is provided by Loupe.
https://loupe.team
[email protected]
1-800-240-7042

# Description
## Installation
Install LPM by downloading the latest version of the installer [here](https://loupe-lpm-assets.s3.us-west-2.amazonaws.com/releases/latest/LPM-Setup.exe). After running the installer, you can run `lpm` commands from your terminal of choice.

## Description

LPM is the Loupe Package Manager. This tool is designed to make it easy to interact with Loupe packages within the Automation Studio and Loupe UX ecosystems. It provides a command line interface for installing packages in a project, and for managing their lifecycle (version update, dependency checks, removal, etc).

# Documentation
## Documentation

Documentation for LPM use, including installation instructions and use cases, can be found [here](https://loupeteam.github.io/LoupeDocs/tools/lpm.html).
Documentation for LPM use, including detailed installation instructions and use cases, can be found [here](https://loupeteam.github.io/LoupeDocs/tools/lpm.html).

# Licensing
## Licensing
This project is licensed under the [MIT License](LICENSE.md).
36 changes: 26 additions & 10 deletions src/LPM.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
This is a lightweight wrapper around NPM that processes Loupe packages.
'''

__version__ = '1.0.1'
__author__ = 'Andrew Musser'

# Python modules
import os.path
import json
Expand All @@ -26,6 +23,12 @@
import time
import requests

with open("version.json", "r") as f:
data = json.load(f)
__version__ = data["version"]

__author__ = 'Andrew Musser'

# External Modules
from ASPython import ASTools

Expand Down Expand Up @@ -987,13 +990,25 @@ def printLoupePackageList():

if not error:
packages_sorted = sorted(data, key=lambda x: x["name"])
for package in packages_sorted:
if package['repository']['description'] is None:
package['repository']['description'] = " "
name_col_width = max(len(package["name"]) for package in packages_sorted) + 2

# Pre-process package descriptions; these are handled separately, as they can be None.
package_descriptions = []
for package in packages_sorted:
try:
if package['repository']['description'] is not None:
package_descriptions.append(package['repository']['description'])
else:
package_descriptions.append(" ")
except:
package_descriptions.append(" ")

# Determine column widths.
name_col_width = max(len(package["name"]) for package in packages_sorted) + 2
version_col_width = 12
lastmod_col_width = 14
description_col_width = max(len(package['repository']['description']) for package in packages_sorted)
description_col_width = max(len(description) for description in package_descriptions)

# Print the header.
print( "NAME".ljust(name_col_width) +
"VERSIONS".ljust(version_col_width) +
"LASTUPDATED".ljust(lastmod_col_width) +
Expand All @@ -1002,11 +1017,12 @@ def printLoupePackageList():
"--------".ljust(version_col_width) +
"-----------".ljust(lastmod_col_width) +
"-----------".ljust(description_col_width))
for package in packages_sorted:

for idx, package in enumerate(packages_sorted):
print( package["name"].ljust(name_col_width) +
str(package["version_count"]).ljust(version_col_width) +
package["updated_at"][:10].ljust(lastmod_col_width) +
package['repository']['description'].ljust(description_col_width))
package_descriptions[idx].ljust(description_col_width))
else:
print(f"Unable to print package list: {error}")

Expand Down
4 changes: 4 additions & 0 deletions src/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "lpm",
"version": "1.0.2"
}
2 changes: 1 addition & 1 deletion utils/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "LPM"
#define MyAppVersion "1.0.1"
#define MyAppVersion "1.0.2"
#define MyAppPublisher "Loupe"
#define MyAppURL "https://loupe.team/"
#define MyAppExeName "LPM.cmd"
Expand Down

0 comments on commit a5ff085

Please sign in to comment.