mirror of
				https://github.com/craigerl/aprsd.git
				synced 2025-11-04 05:30:27 -05:00 
			
		
		
		
	Removed the need for FROMCALL in dev test-plugin
We already use the env var for APRS_LOGIN, so that is now used for the test-plugin command. Also cleaned up some help text
This commit is contained in:
		
							parent
							
								
									2ead6a97da
								
							
						
					
					
						commit
						3463c6eb96
					
				@ -24,6 +24,12 @@ def dev(ctx):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@dev.command()
 | 
					@dev.command()
 | 
				
			||||||
 | 
					@click.option(
 | 
				
			||||||
 | 
					    "--aprs-login",
 | 
				
			||||||
 | 
					    envvar="APRS_LOGIN",
 | 
				
			||||||
 | 
					    show_envvar=True,
 | 
				
			||||||
 | 
					    help="What callsign to send the message from.",
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
@click.option(
 | 
					@click.option(
 | 
				
			||||||
    "-p",
 | 
					    "-p",
 | 
				
			||||||
    "--plugin",
 | 
					    "--plugin",
 | 
				
			||||||
@ -49,19 +55,19 @@ def dev(ctx):
 | 
				
			|||||||
    default=1,
 | 
					    default=1,
 | 
				
			||||||
    help="Number of times to call the plugin",
 | 
					    help="Number of times to call the plugin",
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@click.argument("fromcall")
 | 
					 | 
				
			||||||
@click.argument("message", nargs=-1, required=True)
 | 
					@click.argument("message", nargs=-1, required=True)
 | 
				
			||||||
@click.pass_context
 | 
					@click.pass_context
 | 
				
			||||||
def test_plugin(
 | 
					def test_plugin(
 | 
				
			||||||
    ctx,
 | 
					    ctx,
 | 
				
			||||||
 | 
					    aprs_login,
 | 
				
			||||||
    plugin_path,
 | 
					    plugin_path,
 | 
				
			||||||
    load_all,
 | 
					    load_all,
 | 
				
			||||||
    number,
 | 
					    number,
 | 
				
			||||||
    fromcall,
 | 
					 | 
				
			||||||
    message,
 | 
					    message,
 | 
				
			||||||
):
 | 
					):
 | 
				
			||||||
    """APRSD Plugin test app."""
 | 
					    """APRSD Plugin test app."""
 | 
				
			||||||
    config = ctx.obj["config"]
 | 
					    config = ctx.obj["config"]
 | 
				
			||||||
 | 
					    fromcall = aprs_login
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not plugin_path:
 | 
					    if not plugin_path:
 | 
				
			||||||
        click.echo(ctx.get_help())
 | 
					        click.echo(ctx.get_help())
 | 
				
			||||||
@ -79,6 +85,12 @@ def test_plugin(
 | 
				
			|||||||
    else:
 | 
					    else:
 | 
				
			||||||
        pm._init()
 | 
					        pm._init()
 | 
				
			||||||
    obj = pm._create_class(plugin_path, plugin.APRSDPluginBase, config=config)
 | 
					    obj = pm._create_class(plugin_path, plugin.APRSDPluginBase, config=config)
 | 
				
			||||||
 | 
					    if not obj:
 | 
				
			||||||
 | 
					        click.echo(ctx.get_help())
 | 
				
			||||||
 | 
					        click.echo("")
 | 
				
			||||||
 | 
					        ctx.fail(f"Failed to create object from plugin path '{plugin_path}'")
 | 
				
			||||||
 | 
					        ctx.exit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Register the plugin they wanted tested.
 | 
					    # Register the plugin they wanted tested.
 | 
				
			||||||
    LOG.info(
 | 
					    LOG.info(
 | 
				
			||||||
        "Testing plugin {} Version {}".format(
 | 
					        "Testing plugin {} Version {}".format(
 | 
				
			||||||
 | 
				
			|||||||
@ -62,7 +62,12 @@ def listen(
 | 
				
			|||||||
):
 | 
					):
 | 
				
			||||||
    """Listen to packets on the APRS-IS Network based on FILTER.
 | 
					    """Listen to packets on the APRS-IS Network based on FILTER.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FILTER is the APRS Filter to use. see http://www.aprs-is.net/javAPRSFilter.aspx
 | 
					    FILTER is the APRS Filter to use.\n
 | 
				
			||||||
 | 
					     see http://www.aprs-is.net/javAPRSFilter.aspx\n
 | 
				
			||||||
 | 
					    r/lat/lon/dist - Range Filter Pass posits and objects within dist km from lat/lon.\n
 | 
				
			||||||
 | 
					    p/aa/bb/cc... - Prefix Filter Pass traffic with fromCall that start with aa or bb or cc.\n
 | 
				
			||||||
 | 
					    b/call1/call2... - Budlist Filter Pass all traffic from exact call: call1, call2, ... (* wild card allowed) \n
 | 
				
			||||||
 | 
					    o/obj1/obj2... - Object Filter Pass all objects with the exact name of obj1, obj2, ... (* wild card allowed)\n
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    config = ctx.obj["config"]
 | 
					    config = ctx.obj["config"]
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,10 @@ def send_message(
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            LOG.info(f"L'{aprs_login}' To'{tocallsign}' C'{command}'")
 | 
					            LOG.info(f"L'{aprs_login}' To'{tocallsign}' C'{command}'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    packets.PacketList(config=config)
 | 
				
			||||||
 | 
					    packets.WatchList(config=config)
 | 
				
			||||||
 | 
					    packets.SeenList(config=config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    got_ack = False
 | 
					    got_ack = False
 | 
				
			||||||
    got_response = False
 | 
					    got_response = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -128,8 +132,6 @@ def send_message(
 | 
				
			|||||||
    except LoginError:
 | 
					    except LoginError:
 | 
				
			||||||
        sys.exit(-1)
 | 
					        sys.exit(-1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    packets.PacketList(config=config)
 | 
					 | 
				
			||||||
    packets.WatchList(config=config)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Send a message
 | 
					    # Send a message
 | 
				
			||||||
    # then we setup a consumer to rx messages
 | 
					    # then we setup a consumer to rx messages
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ LOG = logging.getLogger("APRSD")
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
@click.pass_context
 | 
					@click.pass_context
 | 
				
			||||||
def server(ctx, flush):
 | 
					def server(ctx, flush):
 | 
				
			||||||
    """Start the aprsd server process."""
 | 
					    """Start the aprsd server gateway process."""
 | 
				
			||||||
    ctx.obj["config_file"]
 | 
					    ctx.obj["config_file"]
 | 
				
			||||||
    loglevel = ctx.obj["loglevel"]
 | 
					    loglevel = ctx.obj["loglevel"]
 | 
				
			||||||
    quiet = ctx.obj["quiet"]
 | 
					    quiet = ctx.obj["quiet"]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user